{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "https://www.kaggle.com/amitabhajoy/bengaluru-house-price-data"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "import numpy as np\n",
    "from matplotlib import pyplot as plt\n",
    "%matplotlib inline"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>area_type</th>\n",
       "      <th>availability</th>\n",
       "      <th>location</th>\n",
       "      <th>size</th>\n",
       "      <th>society</th>\n",
       "      <th>total_sqft</th>\n",
       "      <th>bath</th>\n",
       "      <th>balcony</th>\n",
       "      <th>price</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>Super built-up  Area</td>\n",
       "      <td>19-Dec</td>\n",
       "      <td>Electronic City Phase II</td>\n",
       "      <td>2 BHK</td>\n",
       "      <td>Coomee</td>\n",
       "      <td>1056</td>\n",
       "      <td>2.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>39.07</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>Plot  Area</td>\n",
       "      <td>Ready To Move</td>\n",
       "      <td>Chikka Tirupathi</td>\n",
       "      <td>4 Bedroom</td>\n",
       "      <td>Theanmp</td>\n",
       "      <td>2600</td>\n",
       "      <td>5.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>120.00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>Built-up  Area</td>\n",
       "      <td>Ready To Move</td>\n",
       "      <td>Uttarahalli</td>\n",
       "      <td>3 BHK</td>\n",
       "      <td>NaN</td>\n",
       "      <td>1440</td>\n",
       "      <td>2.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>62.00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>Super built-up  Area</td>\n",
       "      <td>Ready To Move</td>\n",
       "      <td>Lingadheeranahalli</td>\n",
       "      <td>3 BHK</td>\n",
       "      <td>Soiewre</td>\n",
       "      <td>1521</td>\n",
       "      <td>3.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>95.00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>Super built-up  Area</td>\n",
       "      <td>Ready To Move</td>\n",
       "      <td>Kothanur</td>\n",
       "      <td>2 BHK</td>\n",
       "      <td>NaN</td>\n",
       "      <td>1200</td>\n",
       "      <td>2.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>51.00</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "              area_type   availability                  location       size  \\\n",
       "0  Super built-up  Area         19-Dec  Electronic City Phase II      2 BHK   \n",
       "1            Plot  Area  Ready To Move          Chikka Tirupathi  4 Bedroom   \n",
       "2        Built-up  Area  Ready To Move               Uttarahalli      3 BHK   \n",
       "3  Super built-up  Area  Ready To Move        Lingadheeranahalli      3 BHK   \n",
       "4  Super built-up  Area  Ready To Move                  Kothanur      2 BHK   \n",
       "\n",
       "   society total_sqft  bath  balcony   price  \n",
       "0  Coomee        1056   2.0      1.0   39.07  \n",
       "1  Theanmp       2600   5.0      3.0  120.00  \n",
       "2      NaN       1440   2.0      3.0   62.00  \n",
       "3  Soiewre       1521   3.0      1.0   95.00  \n",
       "4      NaN       1200   2.0      1.0   51.00  "
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df1 = pd.read_csv(\"bengaluru_house_prices.csv\")\n",
    "df1.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Index(['area_type', 'availability', 'location', 'size', 'society',\n",
       "       'total_sqft', 'bath', 'balcony', 'price'],\n",
       "      dtype='object')"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df1.columns"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array(['Super built-up  Area', 'Plot  Area', 'Built-up  Area',\n",
       "       'Carpet  Area'], dtype=object)"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df1['area_type'].unique()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>location</th>\n",
       "      <th>size</th>\n",
       "      <th>total_sqft</th>\n",
       "      <th>bath</th>\n",
       "      <th>balcony</th>\n",
       "      <th>price</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>Electronic City Phase II</td>\n",
       "      <td>2 BHK</td>\n",
       "      <td>1056</td>\n",
       "      <td>2.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>39.07</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>Chikka Tirupathi</td>\n",
       "      <td>4 Bedroom</td>\n",
       "      <td>2600</td>\n",
       "      <td>5.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>120.00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>Uttarahalli</td>\n",
       "      <td>3 BHK</td>\n",
       "      <td>1440</td>\n",
       "      <td>2.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>62.00</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                   location       size total_sqft  bath  balcony   price\n",
       "0  Electronic City Phase II      2 BHK       1056   2.0      1.0   39.07\n",
       "1          Chikka Tirupathi  4 Bedroom       2600   5.0      3.0  120.00\n",
       "2               Uttarahalli      3 BHK       1440   2.0      3.0   62.00"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df2 = df1[['location','size','total_sqft','bath','balcony','price']]\n",
    "df2.head(3)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**Handle NA values**"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "location        1\n",
       "size           16\n",
       "total_sqft      0\n",
       "bath           73\n",
       "balcony       609\n",
       "price           0\n",
       "dtype: int64"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df2.isnull().sum()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df2.total_sqft.isnull().sum()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "location        0\n",
       "size            0\n",
       "total_sqft      0\n",
       "bath           57\n",
       "balcony       593\n",
       "price           0\n",
       "dtype: int64"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df3 = df2[(df2['size'].notnull() & df2['location'].notnull())]\n",
    "df3.isnull().sum()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([ 2.,  5.,  3.,  4.,  6.,  1.,  9., nan,  8.,  7., 11., 10., 14.,\n",
       "       27., 12., 16., 40., 15., 13., 18.])"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df3.bath.unique()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\ProgramData\\Anaconda3\\lib\\site-packages\\ipykernel_launcher.py:1: SettingWithCopyWarning: \n",
      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
      "Try using .loc[row_indexer,col_indexer] = value instead\n",
      "\n",
      "See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy\n",
      "  \"\"\"Entry point for launching an IPython kernel.\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "array([ 2,  4,  3,  6,  1,  8,  7,  5, 11,  9, 27, 10, 19, 16, 43, 14, 12,\n",
       "       13, 18], dtype=int64)"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df3['bhk'] = df3['size'].apply(lambda x: int(x.split(' ')[0]))\n",
    "df3.bhk.unique()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "str"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "type(df3.total_sqft[0])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [],
   "source": [
    "def is_float(x):\n",
    "    try:\n",
    "        float(x)\n",
    "    except:\n",
    "        return False\n",
    "    return True"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>location</th>\n",
       "      <th>size</th>\n",
       "      <th>total_sqft</th>\n",
       "      <th>bath</th>\n",
       "      <th>balcony</th>\n",
       "      <th>price</th>\n",
       "      <th>bhk</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>30</th>\n",
       "      <td>Yelahanka</td>\n",
       "      <td>4 BHK</td>\n",
       "      <td>2100 - 2850</td>\n",
       "      <td>4.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>186.000</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>56</th>\n",
       "      <td>Devanahalli</td>\n",
       "      <td>4 Bedroom</td>\n",
       "      <td>3010 - 3410</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>192.000</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>81</th>\n",
       "      <td>Hennur Road</td>\n",
       "      <td>4 Bedroom</td>\n",
       "      <td>2957 - 3450</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>224.500</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>122</th>\n",
       "      <td>Hebbal</td>\n",
       "      <td>4 BHK</td>\n",
       "      <td>3067 - 8156</td>\n",
       "      <td>4.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>477.000</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>137</th>\n",
       "      <td>8th Phase JP Nagar</td>\n",
       "      <td>2 BHK</td>\n",
       "      <td>1042 - 1105</td>\n",
       "      <td>2.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>54.005</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>165</th>\n",
       "      <td>Sarjapur</td>\n",
       "      <td>2 BHK</td>\n",
       "      <td>1145 - 1340</td>\n",
       "      <td>2.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>43.490</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>188</th>\n",
       "      <td>KR Puram</td>\n",
       "      <td>2 BHK</td>\n",
       "      <td>1015 - 1540</td>\n",
       "      <td>2.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>56.800</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>224</th>\n",
       "      <td>Devanahalli</td>\n",
       "      <td>3 BHK</td>\n",
       "      <td>1520 - 1740</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>74.820</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>410</th>\n",
       "      <td>Kengeri</td>\n",
       "      <td>1 BHK</td>\n",
       "      <td>34.46Sq. Meter</td>\n",
       "      <td>1.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>18.500</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>549</th>\n",
       "      <td>Hennur Road</td>\n",
       "      <td>2 BHK</td>\n",
       "      <td>1195 - 1440</td>\n",
       "      <td>2.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>63.770</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>648</th>\n",
       "      <td>Arekere</td>\n",
       "      <td>9 Bedroom</td>\n",
       "      <td>4125Perch</td>\n",
       "      <td>9.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>265.000</td>\n",
       "      <td>9</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>661</th>\n",
       "      <td>Yelahanka</td>\n",
       "      <td>2 BHK</td>\n",
       "      <td>1120 - 1145</td>\n",
       "      <td>2.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>48.130</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>669</th>\n",
       "      <td>JP Nagar</td>\n",
       "      <td>5 BHK</td>\n",
       "      <td>4400 - 6640</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>375.000</td>\n",
       "      <td>5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>672</th>\n",
       "      <td>Bettahalsoor</td>\n",
       "      <td>4 Bedroom</td>\n",
       "      <td>3090 - 5002</td>\n",
       "      <td>4.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>445.000</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>702</th>\n",
       "      <td>JP Nagar</td>\n",
       "      <td>5 BHK</td>\n",
       "      <td>4400 - 6800</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>548.500</td>\n",
       "      <td>5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>772</th>\n",
       "      <td>Banashankari Stage VI</td>\n",
       "      <td>2 BHK</td>\n",
       "      <td>1160 - 1195</td>\n",
       "      <td>2.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>59.935</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>775</th>\n",
       "      <td>Basavanagara</td>\n",
       "      <td>1 BHK</td>\n",
       "      <td>1000Sq. Meter</td>\n",
       "      <td>2.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>93.000</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>801</th>\n",
       "      <td>JP Nagar</td>\n",
       "      <td>4 BHK</td>\n",
       "      <td>4000 - 5249</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>453.000</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>850</th>\n",
       "      <td>Bannerghatta Road</td>\n",
       "      <td>2 BHK</td>\n",
       "      <td>1115 - 1130</td>\n",
       "      <td>2.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>58.935</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>872</th>\n",
       "      <td>Singapura Village</td>\n",
       "      <td>2 BHK</td>\n",
       "      <td>1100Sq. Yards</td>\n",
       "      <td>2.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>45.000</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>886</th>\n",
       "      <td>Chandapura</td>\n",
       "      <td>1 BHK</td>\n",
       "      <td>520 - 645</td>\n",
       "      <td>1.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>15.135</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>927</th>\n",
       "      <td>Thanisandra</td>\n",
       "      <td>2 BHK</td>\n",
       "      <td>1000 - 1285</td>\n",
       "      <td>2.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>43.415</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>941</th>\n",
       "      <td>Whitefield</td>\n",
       "      <td>4 Bedroom</td>\n",
       "      <td>3606 - 5091</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>304.000</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>959</th>\n",
       "      <td>Kammasandra</td>\n",
       "      <td>1 BHK</td>\n",
       "      <td>650 - 665</td>\n",
       "      <td>1.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>18.410</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>990</th>\n",
       "      <td>Sarjapur</td>\n",
       "      <td>1 BHK</td>\n",
       "      <td>633 - 666</td>\n",
       "      <td>1.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>17.535</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1019</th>\n",
       "      <td>Marathi Layout</td>\n",
       "      <td>1 Bedroom</td>\n",
       "      <td>5.31Acres</td>\n",
       "      <td>1.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>110.000</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1086</th>\n",
       "      <td>Narasapura</td>\n",
       "      <td>2 Bedroom</td>\n",
       "      <td>30Acres</td>\n",
       "      <td>2.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>29.500</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1178</th>\n",
       "      <td>Yelahanka</td>\n",
       "      <td>3 BHK</td>\n",
       "      <td>1445 - 1455</td>\n",
       "      <td>3.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>65.255</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1183</th>\n",
       "      <td>Magadi Road</td>\n",
       "      <td>2 BHK</td>\n",
       "      <td>884 - 1116</td>\n",
       "      <td>2.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>46.500</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1187</th>\n",
       "      <td>Thanisandra</td>\n",
       "      <td>2 BHK</td>\n",
       "      <td>850 - 1093</td>\n",
       "      <td>2.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>36.435</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11389</th>\n",
       "      <td>Electronic City Phase II</td>\n",
       "      <td>4 BHK</td>\n",
       "      <td>2150 - 2225</td>\n",
       "      <td>4.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>105.000</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11407</th>\n",
       "      <td>Whitefield</td>\n",
       "      <td>3 BHK</td>\n",
       "      <td>1520 - 1759</td>\n",
       "      <td>3.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>92.630</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11490</th>\n",
       "      <td>Sarjapur</td>\n",
       "      <td>4 Bedroom</td>\n",
       "      <td>2580 - 2591</td>\n",
       "      <td>4.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>115.000</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11498</th>\n",
       "      <td>Yelahanka</td>\n",
       "      <td>1 BHK</td>\n",
       "      <td>629 - 1026</td>\n",
       "      <td>1.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>42.535</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11583</th>\n",
       "      <td>Bommanahalli</td>\n",
       "      <td>2 BHK</td>\n",
       "      <td>1215 - 1495</td>\n",
       "      <td>2.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>73.170</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11615</th>\n",
       "      <td>arudi</td>\n",
       "      <td>3 Bedroom</td>\n",
       "      <td>6Acres</td>\n",
       "      <td>2.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>80.000</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11650</th>\n",
       "      <td>Yelahanka</td>\n",
       "      <td>2 BHK</td>\n",
       "      <td>1140 - 1250</td>\n",
       "      <td>2.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>53.105</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11764</th>\n",
       "      <td>Begur Road</td>\n",
       "      <td>4 BHK</td>\n",
       "      <td>2400 - 2600</td>\n",
       "      <td>6.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>122.500</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11827</th>\n",
       "      <td>Magadi Road</td>\n",
       "      <td>3 BHK</td>\n",
       "      <td>1052 - 1322</td>\n",
       "      <td>2.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>55.195</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11921</th>\n",
       "      <td>ITPL</td>\n",
       "      <td>4 BHK</td>\n",
       "      <td>5666 - 5669</td>\n",
       "      <td>5.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>300.000</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11969</th>\n",
       "      <td>Thanisandra</td>\n",
       "      <td>1 BHK</td>\n",
       "      <td>620 - 934</td>\n",
       "      <td>1.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>38.460</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12161</th>\n",
       "      <td>Kanakapura</td>\n",
       "      <td>1 BHK</td>\n",
       "      <td>712 - 938</td>\n",
       "      <td>1.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>35.475</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12184</th>\n",
       "      <td>Hennur</td>\n",
       "      <td>3 BHK</td>\n",
       "      <td>1783 - 1878</td>\n",
       "      <td>3.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>84.205</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12186</th>\n",
       "      <td>7th Phase JP Nagar</td>\n",
       "      <td>2 BHK</td>\n",
       "      <td>120Sq. Yards</td>\n",
       "      <td>2.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>51.000</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12252</th>\n",
       "      <td>Gowdanapalya</td>\n",
       "      <td>5 BHK</td>\n",
       "      <td>24Sq. Meter</td>\n",
       "      <td>5.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>75.000</td>\n",
       "      <td>5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12280</th>\n",
       "      <td>Whitefield</td>\n",
       "      <td>4 BHK</td>\n",
       "      <td>2528 - 3188</td>\n",
       "      <td>4.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>137.000</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12334</th>\n",
       "      <td>Budigere</td>\n",
       "      <td>1 BHK</td>\n",
       "      <td>650 - 760</td>\n",
       "      <td>1.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>34.545</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12435</th>\n",
       "      <td>Banashankari Stage VI</td>\n",
       "      <td>3 BHK</td>\n",
       "      <td>1400 - 1421</td>\n",
       "      <td>2.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>70.385</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12544</th>\n",
       "      <td>Hebbal</td>\n",
       "      <td>4 BHK</td>\n",
       "      <td>4000 - 4450</td>\n",
       "      <td>6.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>359.000</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12560</th>\n",
       "      <td>Hosa Road</td>\n",
       "      <td>3 BHK</td>\n",
       "      <td>142.84Sq. Meter</td>\n",
       "      <td>3.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>110.000</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12652</th>\n",
       "      <td>Billamaranahalli</td>\n",
       "      <td>2 Bedroom</td>\n",
       "      <td>300Sq. Yards</td>\n",
       "      <td>2.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>150.000</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12791</th>\n",
       "      <td>Bannerghatta Road</td>\n",
       "      <td>2 BHK</td>\n",
       "      <td>1115 - 1130</td>\n",
       "      <td>2.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>61.740</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12861</th>\n",
       "      <td>KR Puram</td>\n",
       "      <td>4 BHK</td>\n",
       "      <td>2204 - 2362</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>121.000</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12955</th>\n",
       "      <td>Thanisandra</td>\n",
       "      <td>3 BHK</td>\n",
       "      <td>1437 - 1629</td>\n",
       "      <td>3.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>75.885</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12975</th>\n",
       "      <td>Whitefield</td>\n",
       "      <td>2 BHK</td>\n",
       "      <td>850 - 1060</td>\n",
       "      <td>2.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>38.190</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12990</th>\n",
       "      <td>Talaghattapura</td>\n",
       "      <td>3 BHK</td>\n",
       "      <td>1804 - 2273</td>\n",
       "      <td>3.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>122.000</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13059</th>\n",
       "      <td>Harlur</td>\n",
       "      <td>2 BHK</td>\n",
       "      <td>1200 - 1470</td>\n",
       "      <td>2.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>72.760</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13240</th>\n",
       "      <td>Devanahalli</td>\n",
       "      <td>1 BHK</td>\n",
       "      <td>1020 - 1130</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>52.570</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13265</th>\n",
       "      <td>Hoodi</td>\n",
       "      <td>2 BHK</td>\n",
       "      <td>1133 - 1384</td>\n",
       "      <td>2.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>59.135</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13299</th>\n",
       "      <td>Whitefield</td>\n",
       "      <td>4 BHK</td>\n",
       "      <td>2830 - 2882</td>\n",
       "      <td>5.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>154.500</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>239 rows × 7 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                       location       size       total_sqft  bath  balcony  \\\n",
       "30                    Yelahanka      4 BHK      2100 - 2850   4.0      0.0   \n",
       "56                  Devanahalli  4 Bedroom      3010 - 3410   NaN      NaN   \n",
       "81                  Hennur Road  4 Bedroom      2957 - 3450   NaN      NaN   \n",
       "122                      Hebbal      4 BHK      3067 - 8156   4.0      0.0   \n",
       "137          8th Phase JP Nagar      2 BHK      1042 - 1105   2.0      0.0   \n",
       "165                    Sarjapur      2 BHK      1145 - 1340   2.0      0.0   \n",
       "188                    KR Puram      2 BHK      1015 - 1540   2.0      0.0   \n",
       "224                 Devanahalli      3 BHK      1520 - 1740   NaN      NaN   \n",
       "410                     Kengeri      1 BHK   34.46Sq. Meter   1.0      0.0   \n",
       "549                 Hennur Road      2 BHK      1195 - 1440   2.0      0.0   \n",
       "648                     Arekere  9 Bedroom        4125Perch   9.0      NaN   \n",
       "661                   Yelahanka      2 BHK      1120 - 1145   2.0      0.0   \n",
       "669                    JP Nagar      5 BHK      4400 - 6640   NaN      NaN   \n",
       "672                Bettahalsoor  4 Bedroom      3090 - 5002   4.0      0.0   \n",
       "702                    JP Nagar      5 BHK      4400 - 6800   NaN      NaN   \n",
       "772       Banashankari Stage VI      2 BHK      1160 - 1195   2.0      0.0   \n",
       "775                Basavanagara      1 BHK    1000Sq. Meter   2.0      1.0   \n",
       "801                    JP Nagar      4 BHK      4000 - 5249   NaN      NaN   \n",
       "850           Bannerghatta Road      2 BHK      1115 - 1130   2.0      0.0   \n",
       "872           Singapura Village      2 BHK    1100Sq. Yards   2.0      NaN   \n",
       "886                  Chandapura      1 BHK        520 - 645   1.0      0.0   \n",
       "927                 Thanisandra      2 BHK      1000 - 1285   2.0      0.0   \n",
       "941                  Whitefield  4 Bedroom      3606 - 5091   NaN      NaN   \n",
       "959                 Kammasandra      1 BHK        650 - 665   1.0      0.0   \n",
       "990                    Sarjapur      1 BHK        633 - 666   1.0      0.0   \n",
       "1019             Marathi Layout  1 Bedroom        5.31Acres   1.0      0.0   \n",
       "1086                 Narasapura  2 Bedroom          30Acres   2.0      2.0   \n",
       "1178                  Yelahanka      3 BHK      1445 - 1455   3.0      0.0   \n",
       "1183                Magadi Road      2 BHK       884 - 1116   2.0      0.0   \n",
       "1187                Thanisandra      2 BHK       850 - 1093   2.0      0.0   \n",
       "...                         ...        ...              ...   ...      ...   \n",
       "11389  Electronic City Phase II      4 BHK      2150 - 2225   4.0      0.0   \n",
       "11407                Whitefield      3 BHK      1520 - 1759   3.0      0.0   \n",
       "11490                  Sarjapur  4 Bedroom      2580 - 2591   4.0      0.0   \n",
       "11498                 Yelahanka      1 BHK       629 - 1026   1.0      0.0   \n",
       "11583              Bommanahalli      2 BHK      1215 - 1495   2.0      0.0   \n",
       "11615                     arudi  3 Bedroom           6Acres   2.0      0.0   \n",
       "11650                 Yelahanka      2 BHK      1140 - 1250   2.0      0.0   \n",
       "11764                Begur Road      4 BHK      2400 - 2600   6.0      0.0   \n",
       "11827               Magadi Road      3 BHK      1052 - 1322   2.0      0.0   \n",
       "11921                      ITPL      4 BHK      5666 - 5669   5.0      0.0   \n",
       "11969               Thanisandra      1 BHK        620 - 934   1.0      0.0   \n",
       "12161                Kanakapura      1 BHK        712 - 938   1.0      0.0   \n",
       "12184                    Hennur      3 BHK      1783 - 1878   3.0      0.0   \n",
       "12186        7th Phase JP Nagar      2 BHK     120Sq. Yards   2.0      1.0   \n",
       "12252              Gowdanapalya      5 BHK      24Sq. Meter   5.0      0.0   \n",
       "12280                Whitefield      4 BHK      2528 - 3188   4.0      0.0   \n",
       "12334                  Budigere      1 BHK        650 - 760   1.0      0.0   \n",
       "12435     Banashankari Stage VI      3 BHK      1400 - 1421   2.0      0.0   \n",
       "12544                    Hebbal      4 BHK      4000 - 4450   6.0      0.0   \n",
       "12560                 Hosa Road      3 BHK  142.84Sq. Meter   3.0      1.0   \n",
       "12652          Billamaranahalli  2 Bedroom     300Sq. Yards   2.0      2.0   \n",
       "12791         Bannerghatta Road      2 BHK      1115 - 1130   2.0      0.0   \n",
       "12861                  KR Puram      4 BHK      2204 - 2362   NaN      NaN   \n",
       "12955               Thanisandra      3 BHK      1437 - 1629   3.0      0.0   \n",
       "12975                Whitefield      2 BHK       850 - 1060   2.0      0.0   \n",
       "12990            Talaghattapura      3 BHK      1804 - 2273   3.0      0.0   \n",
       "13059                    Harlur      2 BHK      1200 - 1470   2.0      0.0   \n",
       "13240               Devanahalli      1 BHK      1020 - 1130   NaN      NaN   \n",
       "13265                     Hoodi      2 BHK      1133 - 1384   2.0      0.0   \n",
       "13299                Whitefield      4 BHK      2830 - 2882   5.0      0.0   \n",
       "\n",
       "         price  bhk  \n",
       "30     186.000    4  \n",
       "56     192.000    4  \n",
       "81     224.500    4  \n",
       "122    477.000    4  \n",
       "137     54.005    2  \n",
       "165     43.490    2  \n",
       "188     56.800    2  \n",
       "224     74.820    3  \n",
       "410     18.500    1  \n",
       "549     63.770    2  \n",
       "648    265.000    9  \n",
       "661     48.130    2  \n",
       "669    375.000    5  \n",
       "672    445.000    4  \n",
       "702    548.500    5  \n",
       "772     59.935    2  \n",
       "775     93.000    1  \n",
       "801    453.000    4  \n",
       "850     58.935    2  \n",
       "872     45.000    2  \n",
       "886     15.135    1  \n",
       "927     43.415    2  \n",
       "941    304.000    4  \n",
       "959     18.410    1  \n",
       "990     17.535    1  \n",
       "1019   110.000    1  \n",
       "1086    29.500    2  \n",
       "1178    65.255    3  \n",
       "1183    46.500    2  \n",
       "1187    36.435    2  \n",
       "...        ...  ...  \n",
       "11389  105.000    4  \n",
       "11407   92.630    3  \n",
       "11490  115.000    4  \n",
       "11498   42.535    1  \n",
       "11583   73.170    2  \n",
       "11615   80.000    3  \n",
       "11650   53.105    2  \n",
       "11764  122.500    4  \n",
       "11827   55.195    3  \n",
       "11921  300.000    4  \n",
       "11969   38.460    1  \n",
       "12161   35.475    1  \n",
       "12184   84.205    3  \n",
       "12186   51.000    2  \n",
       "12252   75.000    5  \n",
       "12280  137.000    4  \n",
       "12334   34.545    1  \n",
       "12435   70.385    3  \n",
       "12544  359.000    4  \n",
       "12560  110.000    3  \n",
       "12652  150.000    2  \n",
       "12791   61.740    2  \n",
       "12861  121.000    4  \n",
       "12955   75.885    3  \n",
       "12975   38.190    2  \n",
       "12990  122.000    3  \n",
       "13059   72.760    2  \n",
       "13240   52.570    1  \n",
       "13265   59.135    2  \n",
       "13299  154.500    4  \n",
       "\n",
       "[239 rows x 7 columns]"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df3[~df3['total_sqft'].apply(is_float)]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [],
   "source": [
    "def convert_sqft_to_num(x):\n",
    "    tokens = x.split('-')\n",
    "    if len(tokens) == 2:\n",
    "        return (float(tokens[0])+float(tokens[1]))/2\n",
    "    try:\n",
    "        return float(x)\n",
    "    except:\n",
    "        return None   "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\ProgramData\\Anaconda3\\lib\\site-packages\\pandas\\core\\generic.py:5096: SettingWithCopyWarning: \n",
      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
      "Try using .loc[row_indexer,col_indexer] = value instead\n",
      "\n",
      "See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy\n",
      "  self[name] = value\n"
     ]
    }
   ],
   "source": [
    "df3.total_sqft = df3.total_sqft.apply(convert_sqft_to_num)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>location</th>\n",
       "      <th>size</th>\n",
       "      <th>total_sqft</th>\n",
       "      <th>bath</th>\n",
       "      <th>balcony</th>\n",
       "      <th>price</th>\n",
       "      <th>bhk</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>410</th>\n",
       "      <td>Kengeri</td>\n",
       "      <td>1 BHK</td>\n",
       "      <td>NaN</td>\n",
       "      <td>1.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>18.50</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>648</th>\n",
       "      <td>Arekere</td>\n",
       "      <td>9 Bedroom</td>\n",
       "      <td>NaN</td>\n",
       "      <td>9.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>265.00</td>\n",
       "      <td>9</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>775</th>\n",
       "      <td>Basavanagara</td>\n",
       "      <td>1 BHK</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>93.00</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>872</th>\n",
       "      <td>Singapura Village</td>\n",
       "      <td>2 BHK</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>45.00</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1019</th>\n",
       "      <td>Marathi Layout</td>\n",
       "      <td>1 Bedroom</td>\n",
       "      <td>NaN</td>\n",
       "      <td>1.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>110.00</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1086</th>\n",
       "      <td>Narasapura</td>\n",
       "      <td>2 Bedroom</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>29.50</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1400</th>\n",
       "      <td>Chamrajpet</td>\n",
       "      <td>9 BHK</td>\n",
       "      <td>NaN</td>\n",
       "      <td>9.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>296.00</td>\n",
       "      <td>9</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1712</th>\n",
       "      <td>Singena Agrahara</td>\n",
       "      <td>3 Bedroom</td>\n",
       "      <td>NaN</td>\n",
       "      <td>3.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>95.00</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1743</th>\n",
       "      <td>Hosa Road</td>\n",
       "      <td>3 BHK</td>\n",
       "      <td>NaN</td>\n",
       "      <td>3.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>115.00</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1821</th>\n",
       "      <td>Sarjapur</td>\n",
       "      <td>3 Bedroom</td>\n",
       "      <td>NaN</td>\n",
       "      <td>3.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>76.00</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2310</th>\n",
       "      <td>Whitefield</td>\n",
       "      <td>4 BHK</td>\n",
       "      <td>NaN</td>\n",
       "      <td>4.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>270.00</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2881</th>\n",
       "      <td>Volagerekallahalli</td>\n",
       "      <td>2 BHK</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>38.00</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3228</th>\n",
       "      <td>Dodda Banaswadi</td>\n",
       "      <td>5 Bedroom</td>\n",
       "      <td>NaN</td>\n",
       "      <td>5.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>140.00</td>\n",
       "      <td>5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3285</th>\n",
       "      <td>Whitefield</td>\n",
       "      <td>4 Bedroom</td>\n",
       "      <td>NaN</td>\n",
       "      <td>4.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>378.00</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4113</th>\n",
       "      <td>BTM Layout</td>\n",
       "      <td>3 BHK</td>\n",
       "      <td>NaN</td>\n",
       "      <td>3.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>10.00</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4293</th>\n",
       "      <td>Bannerghatta Road</td>\n",
       "      <td>4 BHK</td>\n",
       "      <td>NaN</td>\n",
       "      <td>5.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>260.00</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5453</th>\n",
       "      <td>Kannur</td>\n",
       "      <td>6 Bedroom</td>\n",
       "      <td>NaN</td>\n",
       "      <td>6.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>75.00</td>\n",
       "      <td>6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5537</th>\n",
       "      <td>Frazer Town</td>\n",
       "      <td>3 BHK</td>\n",
       "      <td>NaN</td>\n",
       "      <td>3.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>180.00</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5631</th>\n",
       "      <td>Thanisandra</td>\n",
       "      <td>3 BHK</td>\n",
       "      <td>NaN</td>\n",
       "      <td>4.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>185.00</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5668</th>\n",
       "      <td>Judicial Layout</td>\n",
       "      <td>5 Bedroom</td>\n",
       "      <td>NaN</td>\n",
       "      <td>6.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>400.00</td>\n",
       "      <td>5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5708</th>\n",
       "      <td>Jigani</td>\n",
       "      <td>4 Bedroom</td>\n",
       "      <td>NaN</td>\n",
       "      <td>3.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>160.00</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5976</th>\n",
       "      <td>1st Phase JP Nagar</td>\n",
       "      <td>1 BHK</td>\n",
       "      <td>NaN</td>\n",
       "      <td>1.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>63.00</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6268</th>\n",
       "      <td>Chickpet</td>\n",
       "      <td>2 BHK</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>48.00</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6303</th>\n",
       "      <td>JP Nagar</td>\n",
       "      <td>3 BHK</td>\n",
       "      <td>NaN</td>\n",
       "      <td>3.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>69.34</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6333</th>\n",
       "      <td>Harohalli</td>\n",
       "      <td>2 Bedroom</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>200.00</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6552</th>\n",
       "      <td>5 Bedroom Farm House in Lakshmipura</td>\n",
       "      <td>5 Bedroom</td>\n",
       "      <td>NaN</td>\n",
       "      <td>6.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>550.00</td>\n",
       "      <td>5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6592</th>\n",
       "      <td>Langford Town</td>\n",
       "      <td>4 BHK</td>\n",
       "      <td>NaN</td>\n",
       "      <td>4.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>211.00</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6953</th>\n",
       "      <td>Hosa Road</td>\n",
       "      <td>3 BHK</td>\n",
       "      <td>NaN</td>\n",
       "      <td>3.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>109.00</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7001</th>\n",
       "      <td>Thyagaraja Nagar</td>\n",
       "      <td>8 Bedroom</td>\n",
       "      <td>NaN</td>\n",
       "      <td>6.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>290.00</td>\n",
       "      <td>8</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7248</th>\n",
       "      <td>Hulimavu</td>\n",
       "      <td>2 BHK</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>46.00</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7334</th>\n",
       "      <td>Kanakpura Road</td>\n",
       "      <td>1 Bedroom</td>\n",
       "      <td>NaN</td>\n",
       "      <td>1.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>125.00</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7520</th>\n",
       "      <td>Doddaballapur</td>\n",
       "      <td>3 BHK</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>48.00</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7607</th>\n",
       "      <td>Bommenahalli</td>\n",
       "      <td>3 Bedroom</td>\n",
       "      <td>NaN</td>\n",
       "      <td>3.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>217.00</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7726</th>\n",
       "      <td>Kanakpura Road</td>\n",
       "      <td>1 Bedroom</td>\n",
       "      <td>NaN</td>\n",
       "      <td>1.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>125.00</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8273</th>\n",
       "      <td>V.V Puram</td>\n",
       "      <td>3 BHK</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>150.00</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9423</th>\n",
       "      <td>Ramamurthy Nagar</td>\n",
       "      <td>1 Bedroom</td>\n",
       "      <td>NaN</td>\n",
       "      <td>1.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>48.00</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9519</th>\n",
       "      <td>Bommenahalli</td>\n",
       "      <td>3 Bedroom</td>\n",
       "      <td>NaN</td>\n",
       "      <td>3.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>232.00</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9734</th>\n",
       "      <td>Yelahanka New Town</td>\n",
       "      <td>1 BHK</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>18.00</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10488</th>\n",
       "      <td>2 Bedroom Furnished Farm House in Kolar Road</td>\n",
       "      <td>2 Bedroom</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>200.00</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10491</th>\n",
       "      <td>Rajapura</td>\n",
       "      <td>2 BHK</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>40.00</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11320</th>\n",
       "      <td>Arishinakunte</td>\n",
       "      <td>1 Bedroom</td>\n",
       "      <td>NaN</td>\n",
       "      <td>1.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>170.00</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11615</th>\n",
       "      <td>arudi</td>\n",
       "      <td>3 Bedroom</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>80.00</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12186</th>\n",
       "      <td>7th Phase JP Nagar</td>\n",
       "      <td>2 BHK</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>51.00</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12252</th>\n",
       "      <td>Gowdanapalya</td>\n",
       "      <td>5 BHK</td>\n",
       "      <td>NaN</td>\n",
       "      <td>5.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>75.00</td>\n",
       "      <td>5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12560</th>\n",
       "      <td>Hosa Road</td>\n",
       "      <td>3 BHK</td>\n",
       "      <td>NaN</td>\n",
       "      <td>3.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>110.00</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12652</th>\n",
       "      <td>Billamaranahalli</td>\n",
       "      <td>2 Bedroom</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>150.00</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                                           location       size  total_sqft  \\\n",
       "410                                         Kengeri      1 BHK         NaN   \n",
       "648                                         Arekere  9 Bedroom         NaN   \n",
       "775                                    Basavanagara      1 BHK         NaN   \n",
       "872                               Singapura Village      2 BHK         NaN   \n",
       "1019                                 Marathi Layout  1 Bedroom         NaN   \n",
       "1086                                     Narasapura  2 Bedroom         NaN   \n",
       "1400                                     Chamrajpet      9 BHK         NaN   \n",
       "1712                               Singena Agrahara  3 Bedroom         NaN   \n",
       "1743                                      Hosa Road      3 BHK         NaN   \n",
       "1821                                       Sarjapur  3 Bedroom         NaN   \n",
       "2310                                     Whitefield      4 BHK         NaN   \n",
       "2881                             Volagerekallahalli      2 BHK         NaN   \n",
       "3228                                Dodda Banaswadi  5 Bedroom         NaN   \n",
       "3285                                     Whitefield  4 Bedroom         NaN   \n",
       "4113                                     BTM Layout      3 BHK         NaN   \n",
       "4293                              Bannerghatta Road      4 BHK         NaN   \n",
       "5453                                         Kannur  6 Bedroom         NaN   \n",
       "5537                                    Frazer Town      3 BHK         NaN   \n",
       "5631                                    Thanisandra      3 BHK         NaN   \n",
       "5668                                Judicial Layout  5 Bedroom         NaN   \n",
       "5708                                         Jigani  4 Bedroom         NaN   \n",
       "5976                             1st Phase JP Nagar      1 BHK         NaN   \n",
       "6268                                       Chickpet      2 BHK         NaN   \n",
       "6303                                       JP Nagar      3 BHK         NaN   \n",
       "6333                                      Harohalli  2 Bedroom         NaN   \n",
       "6552            5 Bedroom Farm House in Lakshmipura  5 Bedroom         NaN   \n",
       "6592                                  Langford Town      4 BHK         NaN   \n",
       "6953                                      Hosa Road      3 BHK         NaN   \n",
       "7001                               Thyagaraja Nagar  8 Bedroom         NaN   \n",
       "7248                                       Hulimavu      2 BHK         NaN   \n",
       "7334                                 Kanakpura Road  1 Bedroom         NaN   \n",
       "7520                                  Doddaballapur      3 BHK         NaN   \n",
       "7607                                   Bommenahalli  3 Bedroom         NaN   \n",
       "7726                                 Kanakpura Road  1 Bedroom         NaN   \n",
       "8273                                      V.V Puram      3 BHK         NaN   \n",
       "9423                               Ramamurthy Nagar  1 Bedroom         NaN   \n",
       "9519                                   Bommenahalli  3 Bedroom         NaN   \n",
       "9734                             Yelahanka New Town      1 BHK         NaN   \n",
       "10488  2 Bedroom Furnished Farm House in Kolar Road  2 Bedroom         NaN   \n",
       "10491                                      Rajapura      2 BHK         NaN   \n",
       "11320                                 Arishinakunte  1 Bedroom         NaN   \n",
       "11615                                         arudi  3 Bedroom         NaN   \n",
       "12186                            7th Phase JP Nagar      2 BHK         NaN   \n",
       "12252                                  Gowdanapalya      5 BHK         NaN   \n",
       "12560                                     Hosa Road      3 BHK         NaN   \n",
       "12652                              Billamaranahalli  2 Bedroom         NaN   \n",
       "\n",
       "       bath  balcony   price  bhk  \n",
       "410     1.0      0.0   18.50    1  \n",
       "648     9.0      NaN  265.00    9  \n",
       "775     2.0      1.0   93.00    1  \n",
       "872     2.0      NaN   45.00    2  \n",
       "1019    1.0      0.0  110.00    1  \n",
       "1086    2.0      2.0   29.50    2  \n",
       "1400    9.0      1.0  296.00    9  \n",
       "1712    3.0      1.0   95.00    3  \n",
       "1743    3.0      1.0  115.00    3  \n",
       "1821    3.0      1.0   76.00    3  \n",
       "2310    4.0      NaN  270.00    4  \n",
       "2881    2.0      2.0   38.00    2  \n",
       "3228    5.0      1.0  140.00    5  \n",
       "3285    4.0      2.0  378.00    4  \n",
       "4113    3.0      2.0   10.00    3  \n",
       "4293    5.0      NaN  260.00    4  \n",
       "5453    6.0      3.0   75.00    6  \n",
       "5537    3.0      1.0  180.00    3  \n",
       "5631    4.0      2.0  185.00    3  \n",
       "5668    6.0      3.0  400.00    5  \n",
       "5708    3.0      2.0  160.00    4  \n",
       "5976    1.0      1.0   63.00    1  \n",
       "6268    2.0      0.0   48.00    2  \n",
       "6303    3.0      1.0   69.34    3  \n",
       "6333    2.0      0.0  200.00    2  \n",
       "6552    6.0      2.0  550.00    5  \n",
       "6592    4.0      2.0  211.00    4  \n",
       "6953    3.0      1.0  109.00    3  \n",
       "7001    6.0      2.0  290.00    8  \n",
       "7248    2.0      3.0   46.00    2  \n",
       "7334    1.0      0.0  125.00    1  \n",
       "7520    2.0      1.0   48.00    3  \n",
       "7607    3.0      1.0  217.00    3  \n",
       "7726    1.0      0.0  125.00    1  \n",
       "8273    2.0      0.0  150.00    3  \n",
       "9423    1.0      1.0   48.00    1  \n",
       "9519    3.0      1.0  232.00    3  \n",
       "9734    2.0      1.0   18.00    1  \n",
       "10488   2.0      2.0  200.00    2  \n",
       "10491   2.0      2.0   40.00    2  \n",
       "11320   1.0      0.0  170.00    1  \n",
       "11615   2.0      0.0   80.00    3  \n",
       "12186   2.0      1.0   51.00    2  \n",
       "12252   5.0      0.0   75.00    5  \n",
       "12560   3.0      1.0  110.00    3  \n",
       "12652   2.0      2.0  150.00    2  "
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df3[df3.total_sqft.isnull()]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0"
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df4 = df3[~(df3.total_sqft.isnull())]\n",
    "df4.total_sqft.isnull().sum()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<h2 style=\"color:purple\">Clean up data using price per square feet</h2>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**Find out price per square feet**"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\ProgramData\\Anaconda3\\lib\\site-packages\\ipykernel_launcher.py:1: SettingWithCopyWarning: \n",
      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
      "Try using .loc[row_indexer,col_indexer] = value instead\n",
      "\n",
      "See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy\n",
      "  \"\"\"Entry point for launching an IPython kernel.\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>location</th>\n",
       "      <th>size</th>\n",
       "      <th>total_sqft</th>\n",
       "      <th>bath</th>\n",
       "      <th>balcony</th>\n",
       "      <th>price</th>\n",
       "      <th>bhk</th>\n",
       "      <th>price_per_sqft</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>Electronic City Phase II</td>\n",
       "      <td>2 BHK</td>\n",
       "      <td>1056.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>39.07</td>\n",
       "      <td>2</td>\n",
       "      <td>3699.810606</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>Chikka Tirupathi</td>\n",
       "      <td>4 Bedroom</td>\n",
       "      <td>2600.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>120.00</td>\n",
       "      <td>4</td>\n",
       "      <td>4615.384615</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>Uttarahalli</td>\n",
       "      <td>3 BHK</td>\n",
       "      <td>1440.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>62.00</td>\n",
       "      <td>3</td>\n",
       "      <td>4305.555556</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>Lingadheeranahalli</td>\n",
       "      <td>3 BHK</td>\n",
       "      <td>1521.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>95.00</td>\n",
       "      <td>3</td>\n",
       "      <td>6245.890861</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>Kothanur</td>\n",
       "      <td>2 BHK</td>\n",
       "      <td>1200.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>51.00</td>\n",
       "      <td>2</td>\n",
       "      <td>4250.000000</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                   location       size  total_sqft  bath  balcony   price  \\\n",
       "0  Electronic City Phase II      2 BHK      1056.0   2.0      1.0   39.07   \n",
       "1          Chikka Tirupathi  4 Bedroom      2600.0   5.0      3.0  120.00   \n",
       "2               Uttarahalli      3 BHK      1440.0   2.0      3.0   62.00   \n",
       "3        Lingadheeranahalli      3 BHK      1521.0   3.0      1.0   95.00   \n",
       "4                  Kothanur      2 BHK      1200.0   2.0      1.0   51.00   \n",
       "\n",
       "   bhk  price_per_sqft  \n",
       "0    2     3699.810606  \n",
       "1    4     4615.384615  \n",
       "2    3     4305.555556  \n",
       "3    3     6245.890861  \n",
       "4    2     4250.000000  "
      ]
     },
     "execution_count": 19,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df4['price_per_sqft'] = df4['price']*100000/df4['total_sqft']\n",
    "df4.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "count    1.325700e+04\n",
       "mean     7.912825e+03\n",
       "std      1.064976e+05\n",
       "min      2.678298e+02\n",
       "25%      4.271186e+03\n",
       "50%      5.438596e+03\n",
       "75%      7.313318e+03\n",
       "max      1.200000e+07\n",
       "Name: price_per_sqft, dtype: float64"
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df4['price_per_sqft'].describe()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [],
   "source": [
    "max_price_per_sqft = int(max(df4['price_per_sqft']))\n",
    "b = range(0,max_price_per_sqft,10000)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(array([11439.,  1544.,   225., ...,     0.,     0.,     0.]),\n",
       " array([       0,    10000,    20000, ..., 11970000, 11980000, 11990000]),\n",
       " <a list of 1199 Patch objects>)"
      ]
     },
     "execution_count": 22,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYcAAAEJCAYAAAB/pOvWAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4zLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvnQurowAAE1ZJREFUeJzt3W2QneV93/Hvz6jgOLENNrLHlaCSE8WJzCQ1PQMk6biJyYAgGYsXuCPGCaqjqSYucdOmMw3UL+jYeRH3IbRMbSca41p4XB5C3aJJiKkKZJxJDGYVCOYhWFuTwhZq5EqQpExty/n3xblEjnWttGfPETq74vuZ2dn7/t/XffZ/ze7qp/vh3JuqQpKkUa+ZdQOSpJXHcJAkdQwHSVLHcJAkdQwHSVLHcJAkdZYMhySfTvJ8kkdHav86yZ8meSTJf0ly5si265LMJ3kyyaUj9S2tNp/k2pH6xiQPJNmf5LYkp5/ICUqSlm+cI4fPAFuOq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amsI435c1DE8t/STD/9X9QZLzquqFV7i35RpnLlcBn6mqf5vkx4DPtrn81Svf3gm1Gn7nlyXJTzEMh797Il/3VD5yGOeRHC+PSbKG4eHy8Q5JZ2GsR4sk+Wngw8B7q+qbJ6m35VpqLq8HzgN+P8mfMTwnvGeFXpQe9+frzqr6dlU9BTzJMCxWmnHmsgO4HaCqvgS8luHzfVabsX6fVoskPwJ8CthaVf/nRL72qRwO4zySYw+wvS1fCdxb7erOCrLkPNqpmN9iGAwr9bw2LDGXqnqxqs6uqg1VtYHhedT3VtXcbNo9rnF+vv4rw5sFSHI2w9NMXzupXY5nnLk8DVwMkOSHGYbDgZPa5YmxB7i63bV0EfBiVT0366YmkeRc4PPAz1fVV0/4F5j1FflX+Gr/5cBXGd6J8eFW+wjDf3Bg+AP+28A88GXg7bPuecJ5/Hfg68DD7WPPrHuedC5Hjf19VujdSmN+XwL8BvA48BVg26x7nmIum4E/ZHgn08PAJbPu+RjzuAV4Dvg2w6OEHcAvAr848j35eJvnV1b4z9dSc/kUcGjk937uRH593yEtSeqcyqeVJEkTMhwkSR3DQZLUMRwkSR3DQZJWgaUexHfU2BuSPNw+vppk2W+89G4lSVoFkrwb+EuGz4Y6bxn7fQh4V1X9wnK+nkcOkrQK1CIP4kvy/Um+kGRfkj9I8kOL7HoVw/dMLMup/GwlSTrV7WL4prj9SS4EPgG858jG9rddNgL3LveFDQdJWoWSfB/Dv+nw2yN/aeCMo4ZtA+6oqu8s9/UNB0lanV4DvFBVf/s4Y7YB10z64pKkVaaq/hx4Ksn74OU/gfrynwpN8g7gLOBLk7y+4SBJq0CSWxj+Q/+OJAtJdgDvB3Yk+RPgMb77L/hdBdxaE96S6q2skqSORw6SpI7hIEnqGA6SpI7hIEnqGA6SpI7hIEnqGA6SpI7hIEnq/H9RtgFWr92xegAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.hist(df4.price_per_sqft,bins=b)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**Use log scale for better viewing of the chart**"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(array([11439.,  1544.,   225., ...,     0.,     0.,     0.]),\n",
       " array([       0,    10000,    20000, ..., 11970000, 11980000, 11990000]),\n",
       " <a list of 1199 Patch objects>)"
      ]
     },
     "execution_count": 23,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAZUAAAEOCAYAAABB+oq7AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4zLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvnQurowAAF5JJREFUeJzt3X+wX3V95/Hni0RAUQE1Mgi4oTWrRcZajIC/ulnpSlDX2A60OM4aaHazumitbq1Qd5ZdLTs4OoI/sYxQwbEiUjsgUmkWUekuAokg8kNKRhCysBI3GPF3g+/94/u58CXcm/u9yefeb27yfMx8557zPp9zzuecQ+6L8+Oeb6oKSZJ62GPcHZAk7ToMFUlSN4aKJKkbQ0WS1I2hIknqxlCRJHUza6GS5PwkDyS5Zaj2gSTfTXJzkr9Lst/QtNOSrE9yR5Jjh+rLW219klOH6ocmuS7JnUk+n2TP2doWSdJoZvNM5dPA8q1qa4DDq+oFwD8BpwEkOQw4EXh+m+cTSRYkWQB8HDgOOAx4Q2sL8H7grKpaAjwIrJrFbZEkjWDWQqWqvgFs2qr2D1W1pY1+Ezi4Da8ALqqqX1bVXcB64Mj2WV9V36uqXwEXASuSBHglcEmb/wLg9bO1LZKk0YzznsofA3/fhg8C7h2atqHVpqo/HfjRUEBN1CVJY7RwHCtN8h5gC/DZidIkzYrJQ6+20X6q9a0GVgPss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bgwVSVI3hookqRtDRZLUzf8HzHU/58M45EYAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.xscale('log')\n",
    "plt.xlabel('Price Per Square Feet')\n",
    "plt.ylabel('Count')\n",
    "plt.hist(df4.price_per_sqft,bins=b, rwidth=0.3,align='right')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**Based on above chart it looks like we should exclude anything that has price_per_sqft > 10000. But before excluding them\n",
    "let's eyeball those data points that are going to be excluded**"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>location</th>\n",
       "      <th>size</th>\n",
       "      <th>total_sqft</th>\n",
       "      <th>bath</th>\n",
       "      <th>balcony</th>\n",
       "      <th>price</th>\n",
       "      <th>bhk</th>\n",
       "      <th>price_per_sqft</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>Rajaji Nagar</td>\n",
       "      <td>4 BHK</td>\n",
       "      <td>3300.0</td>\n",
       "      <td>4.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>600.0</td>\n",
       "      <td>4</td>\n",
       "      <td>18181.818182</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>Gandhi Bazar</td>\n",
       "      <td>6 Bedroom</td>\n",
       "      <td>1020.0</td>\n",
       "      <td>6.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>370.0</td>\n",
       "      <td>6</td>\n",
       "      <td>36274.509804</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>Whitefield</td>\n",
       "      <td>4 Bedroom</td>\n",
       "      <td>2785.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>295.0</td>\n",
       "      <td>4</td>\n",
       "      <td>10592.459605</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>Ramakrishnappa Layout</td>\n",
       "      <td>3 BHK</td>\n",
       "      <td>2770.0</td>\n",
       "      <td>4.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>290.0</td>\n",
       "      <td>3</td>\n",
       "      <td>10469.314079</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>22</th>\n",
       "      <td>Thanisandra</td>\n",
       "      <td>4 Bedroom</td>\n",
       "      <td>2800.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>380.0</td>\n",
       "      <td>4</td>\n",
       "      <td>13571.428571</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>45</th>\n",
       "      <td>HSR Layout</td>\n",
       "      <td>8 Bedroom</td>\n",
       "      <td>600.0</td>\n",
       "      <td>9.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>200.0</td>\n",
       "      <td>8</td>\n",
       "      <td>33333.333333</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>48</th>\n",
       "      <td>KR Puram</td>\n",
       "      <td>2 Bedroom</td>\n",
       "      <td>800.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>130.0</td>\n",
       "      <td>2</td>\n",
       "      <td>16250.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>57</th>\n",
       "      <td>Ramakrishnappa Layout</td>\n",
       "      <td>2 BHK</td>\n",
       "      <td>1500.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>185.0</td>\n",
       "      <td>2</td>\n",
       "      <td>12333.333333</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>58</th>\n",
       "      <td>Murugeshpalya</td>\n",
       "      <td>6 Bedroom</td>\n",
       "      <td>1407.0</td>\n",
       "      <td>4.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>150.0</td>\n",
       "      <td>6</td>\n",
       "      <td>10660.980810</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>62</th>\n",
       "      <td>Whitefield</td>\n",
       "      <td>4 Bedroom</td>\n",
       "      <td>5700.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>650.0</td>\n",
       "      <td>4</td>\n",
       "      <td>11403.508772</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>70</th>\n",
       "      <td>Double Road</td>\n",
       "      <td>3 Bedroom</td>\n",
       "      <td>500.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>100.0</td>\n",
       "      <td>3</td>\n",
       "      <td>20000.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>89</th>\n",
       "      <td>Rajaji Nagar</td>\n",
       "      <td>6 Bedroom</td>\n",
       "      <td>710.0</td>\n",
       "      <td>6.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>160.0</td>\n",
       "      <td>6</td>\n",
       "      <td>22535.211268</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>93</th>\n",
       "      <td>ISRO Layout</td>\n",
       "      <td>4 Bedroom</td>\n",
       "      <td>1200.0</td>\n",
       "      <td>4.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>155.0</td>\n",
       "      <td>4</td>\n",
       "      <td>12916.666667</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>107</th>\n",
       "      <td>Rajaji Nagar</td>\n",
       "      <td>3 BHK</td>\n",
       "      <td>1640.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>229.0</td>\n",
       "      <td>3</td>\n",
       "      <td>13963.414634</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>129</th>\n",
       "      <td>Vishwapriya Layout</td>\n",
       "      <td>7 Bedroom</td>\n",
       "      <td>950.0</td>\n",
       "      <td>7.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>115.0</td>\n",
       "      <td>7</td>\n",
       "      <td>12105.263158</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>133</th>\n",
       "      <td>Ramaswamy Palya - Kammanahalli Main Road</td>\n",
       "      <td>4 Bedroom</td>\n",
       "      <td>1200.0</td>\n",
       "      <td>4.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>210.0</td>\n",
       "      <td>4</td>\n",
       "      <td>17500.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>149</th>\n",
       "      <td>Dinnur</td>\n",
       "      <td>6 Bedroom</td>\n",
       "      <td>1034.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>185.0</td>\n",
       "      <td>6</td>\n",
       "      <td>17891.682785</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>159</th>\n",
       "      <td>Mahalakshmi Layout</td>\n",
       "      <td>4 Bedroom</td>\n",
       "      <td>3750.0</td>\n",
       "      <td>4.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>760.0</td>\n",
       "      <td>4</td>\n",
       "      <td>20266.666667</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>176</th>\n",
       "      <td>Kumaraswami Layout</td>\n",
       "      <td>5 Bedroom</td>\n",
       "      <td>600.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>85.0</td>\n",
       "      <td>5</td>\n",
       "      <td>14166.666667</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>185</th>\n",
       "      <td>8th block Koramangala</td>\n",
       "      <td>3 Bedroom</td>\n",
       "      <td>1846.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>300.0</td>\n",
       "      <td>3</td>\n",
       "      <td>16251.354280</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>192</th>\n",
       "      <td>Bellandur</td>\n",
       "      <td>4 Bedroom</td>\n",
       "      <td>1200.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>325.0</td>\n",
       "      <td>4</td>\n",
       "      <td>27083.333333</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>193</th>\n",
       "      <td>Ejipura</td>\n",
       "      <td>7 Bedroom</td>\n",
       "      <td>1800.0</td>\n",
       "      <td>7.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>250.0</td>\n",
       "      <td>7</td>\n",
       "      <td>13888.888889</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>209</th>\n",
       "      <td>Padmanabhanagar</td>\n",
       "      <td>4 Bedroom</td>\n",
       "      <td>1736.0</td>\n",
       "      <td>6.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>190.0</td>\n",
       "      <td>4</td>\n",
       "      <td>10944.700461</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>210</th>\n",
       "      <td>1st Block Jayanagar</td>\n",
       "      <td>4 BHK</td>\n",
       "      <td>2850.0</td>\n",
       "      <td>4.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>428.0</td>\n",
       "      <td>4</td>\n",
       "      <td>15017.543860</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>225</th>\n",
       "      <td>Muthurayya Swamy Layout</td>\n",
       "      <td>3 BHK</td>\n",
       "      <td>2405.0</td>\n",
       "      <td>4.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>260.0</td>\n",
       "      <td>3</td>\n",
       "      <td>10810.810811</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>258</th>\n",
       "      <td>MCECHS  layout</td>\n",
       "      <td>5 Bedroom</td>\n",
       "      <td>1200.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>170.0</td>\n",
       "      <td>5</td>\n",
       "      <td>14166.666667</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>260</th>\n",
       "      <td>Ambedkar Nagar</td>\n",
       "      <td>4 Bedroom</td>\n",
       "      <td>2900.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>300.0</td>\n",
       "      <td>4</td>\n",
       "      <td>10344.827586</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>273</th>\n",
       "      <td>Sundara Nagar</td>\n",
       "      <td>2 Bedroom</td>\n",
       "      <td>900.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>110.0</td>\n",
       "      <td>2</td>\n",
       "      <td>12222.222222</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>282</th>\n",
       "      <td>Srirampura</td>\n",
       "      <td>6 Bedroom</td>\n",
       "      <td>1450.0</td>\n",
       "      <td>6.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>250.0</td>\n",
       "      <td>6</td>\n",
       "      <td>17241.379310</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>299</th>\n",
       "      <td>Giri Nagar</td>\n",
       "      <td>3 Bedroom</td>\n",
       "      <td>880.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>140.0</td>\n",
       "      <td>3</td>\n",
       "      <td>15909.090909</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13104</th>\n",
       "      <td>Church Street</td>\n",
       "      <td>4 BHK</td>\n",
       "      <td>2920.0</td>\n",
       "      <td>4.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>536.0</td>\n",
       "      <td>4</td>\n",
       "      <td>18356.164384</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13119</th>\n",
       "      <td>Sathya Sai Layout</td>\n",
       "      <td>4 Bedroom</td>\n",
       "      <td>6688.0</td>\n",
       "      <td>6.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>700.0</td>\n",
       "      <td>4</td>\n",
       "      <td>10466.507177</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13126</th>\n",
       "      <td>Akshaya Nagar</td>\n",
       "      <td>4 Bedroom</td>\n",
       "      <td>1200.0</td>\n",
       "      <td>4.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>125.0</td>\n",
       "      <td>4</td>\n",
       "      <td>10416.666667</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13132</th>\n",
       "      <td>1st Block Koramangala</td>\n",
       "      <td>4 Bedroom</td>\n",
       "      <td>1200.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>350.0</td>\n",
       "      <td>4</td>\n",
       "      <td>29166.666667</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13167</th>\n",
       "      <td>Benson Town</td>\n",
       "      <td>2 Bedroom</td>\n",
       "      <td>1688.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>280.0</td>\n",
       "      <td>2</td>\n",
       "      <td>16587.677725</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13168</th>\n",
       "      <td>Ulsoor</td>\n",
       "      <td>2 Bedroom</td>\n",
       "      <td>1160.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>130.0</td>\n",
       "      <td>2</td>\n",
       "      <td>11206.896552</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13180</th>\n",
       "      <td>Sarakki Nagar</td>\n",
       "      <td>4 BHK</td>\n",
       "      <td>3124.0</td>\n",
       "      <td>6.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>349.0</td>\n",
       "      <td>4</td>\n",
       "      <td>11171.574904</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13183</th>\n",
       "      <td>Shivaji Nagar</td>\n",
       "      <td>2 BHK</td>\n",
       "      <td>600.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>65.0</td>\n",
       "      <td>2</td>\n",
       "      <td>10833.333333</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13190</th>\n",
       "      <td>Yelahanka</td>\n",
       "      <td>5 Bedroom</td>\n",
       "      <td>1330.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>210.0</td>\n",
       "      <td>5</td>\n",
       "      <td>15789.473684</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13197</th>\n",
       "      <td>Ramakrishnappa Layout</td>\n",
       "      <td>4 Bedroom</td>\n",
       "      <td>9200.0</td>\n",
       "      <td>4.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2600.0</td>\n",
       "      <td>4</td>\n",
       "      <td>28260.869565</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13198</th>\n",
       "      <td>Pattegarhpalya</td>\n",
       "      <td>8 Bedroom</td>\n",
       "      <td>1200.0</td>\n",
       "      <td>8.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>140.0</td>\n",
       "      <td>8</td>\n",
       "      <td>11666.666667</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13200</th>\n",
       "      <td>Defence Colony</td>\n",
       "      <td>6 Bedroom</td>\n",
       "      <td>8000.0</td>\n",
       "      <td>6.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>2800.0</td>\n",
       "      <td>6</td>\n",
       "      <td>35000.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13213</th>\n",
       "      <td>Rajarajeshwari nagar</td>\n",
       "      <td>4 Bedroom</td>\n",
       "      <td>1200.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>325.0</td>\n",
       "      <td>4</td>\n",
       "      <td>27083.333333</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13215</th>\n",
       "      <td>Frazer Town</td>\n",
       "      <td>1 Bedroom</td>\n",
       "      <td>896.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>100.0</td>\n",
       "      <td>1</td>\n",
       "      <td>11160.714286</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13216</th>\n",
       "      <td>Tilak Nagar</td>\n",
       "      <td>1 BHK</td>\n",
       "      <td>250.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>40.0</td>\n",
       "      <td>1</td>\n",
       "      <td>16000.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13217</th>\n",
       "      <td>T Dasarahalli</td>\n",
       "      <td>6 Bedroom</td>\n",
       "      <td>1200.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>125.0</td>\n",
       "      <td>6</td>\n",
       "      <td>10416.666667</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13233</th>\n",
       "      <td>7th Block Jayanagar</td>\n",
       "      <td>3 BHK</td>\n",
       "      <td>1903.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>293.0</td>\n",
       "      <td>3</td>\n",
       "      <td>15396.741986</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13245</th>\n",
       "      <td>12th cross srinivas nagar banshankari 3rd stage</td>\n",
       "      <td>1 BHK</td>\n",
       "      <td>1800.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>200.0</td>\n",
       "      <td>1</td>\n",
       "      <td>11111.111111</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13247</th>\n",
       "      <td>5th Stage BEML Layout</td>\n",
       "      <td>4 Bedroom</td>\n",
       "      <td>1200.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>325.0</td>\n",
       "      <td>4</td>\n",
       "      <td>27083.333333</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13261</th>\n",
       "      <td>Havanur extension</td>\n",
       "      <td>3 Bedroom</td>\n",
       "      <td>2000.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>360.0</td>\n",
       "      <td>3</td>\n",
       "      <td>18000.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13262</th>\n",
       "      <td>Abshot Layout</td>\n",
       "      <td>2 BHK</td>\n",
       "      <td>1140.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>185.0</td>\n",
       "      <td>2</td>\n",
       "      <td>16228.070175</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13277</th>\n",
       "      <td>Kundalahalli Colony</td>\n",
       "      <td>7 Bedroom</td>\n",
       "      <td>1400.0</td>\n",
       "      <td>7.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>218.0</td>\n",
       "      <td>7</td>\n",
       "      <td>15571.428571</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13279</th>\n",
       "      <td>Vishwanatha Nagenahalli</td>\n",
       "      <td>6 Bedroom</td>\n",
       "      <td>1200.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>130.0</td>\n",
       "      <td>6</td>\n",
       "      <td>10833.333333</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13290</th>\n",
       "      <td>Sarjapur  Road</td>\n",
       "      <td>4 BHK</td>\n",
       "      <td>4050.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>450.0</td>\n",
       "      <td>4</td>\n",
       "      <td>11111.111111</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13296</th>\n",
       "      <td>Cox Town</td>\n",
       "      <td>2 BHK</td>\n",
       "      <td>1200.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>140.0</td>\n",
       "      <td>2</td>\n",
       "      <td>11666.666667</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13305</th>\n",
       "      <td>Hulimavu</td>\n",
       "      <td>1 BHK</td>\n",
       "      <td>500.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>220.0</td>\n",
       "      <td>1</td>\n",
       "      <td>44000.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13306</th>\n",
       "      <td>Rajarajeshwari Nagara</td>\n",
       "      <td>4 Bedroom</td>\n",
       "      <td>1200.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>325.0</td>\n",
       "      <td>4</td>\n",
       "      <td>27083.333333</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13311</th>\n",
       "      <td>Ramamurthy Nagar</td>\n",
       "      <td>7 Bedroom</td>\n",
       "      <td>1500.0</td>\n",
       "      <td>9.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>250.0</td>\n",
       "      <td>7</td>\n",
       "      <td>16666.666667</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13316</th>\n",
       "      <td>Richards Town</td>\n",
       "      <td>4 BHK</td>\n",
       "      <td>3600.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>400.0</td>\n",
       "      <td>4</td>\n",
       "      <td>11111.111111</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13318</th>\n",
       "      <td>Padmanabhanagar</td>\n",
       "      <td>4 BHK</td>\n",
       "      <td>4689.0</td>\n",
       "      <td>4.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>488.0</td>\n",
       "      <td>4</td>\n",
       "      <td>10407.336319</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>1741 rows × 8 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                                              location       size  total_sqft  \\\n",
       "7                                         Rajaji Nagar      4 BHK      3300.0   \n",
       "9                                         Gandhi Bazar  6 Bedroom      1020.0   \n",
       "11                                          Whitefield  4 Bedroom      2785.0   \n",
       "18                               Ramakrishnappa Layout      3 BHK      2770.0   \n",
       "22                                         Thanisandra  4 Bedroom      2800.0   \n",
       "45                                          HSR Layout  8 Bedroom       600.0   \n",
       "48                                            KR Puram  2 Bedroom       800.0   \n",
       "57                               Ramakrishnappa Layout      2 BHK      1500.0   \n",
       "58                                       Murugeshpalya  6 Bedroom      1407.0   \n",
       "62                                          Whitefield  4 Bedroom      5700.0   \n",
       "70                                         Double Road  3 Bedroom       500.0   \n",
       "89                                        Rajaji Nagar  6 Bedroom       710.0   \n",
       "93                                         ISRO Layout  4 Bedroom      1200.0   \n",
       "107                                       Rajaji Nagar      3 BHK      1640.0   \n",
       "129                                 Vishwapriya Layout  7 Bedroom       950.0   \n",
       "133           Ramaswamy Palya - Kammanahalli Main Road  4 Bedroom      1200.0   \n",
       "149                                             Dinnur  6 Bedroom      1034.0   \n",
       "159                                 Mahalakshmi Layout  4 Bedroom      3750.0   \n",
       "176                                 Kumaraswami Layout  5 Bedroom       600.0   \n",
       "185                              8th block Koramangala  3 Bedroom      1846.0   \n",
       "192                                          Bellandur  4 Bedroom      1200.0   \n",
       "193                                            Ejipura  7 Bedroom      1800.0   \n",
       "209                                    Padmanabhanagar  4 Bedroom      1736.0   \n",
       "210                                1st Block Jayanagar      4 BHK      2850.0   \n",
       "225                            Muthurayya Swamy Layout      3 BHK      2405.0   \n",
       "258                                     MCECHS  layout  5 Bedroom      1200.0   \n",
       "260                                     Ambedkar Nagar  4 Bedroom      2900.0   \n",
       "273                                      Sundara Nagar  2 Bedroom       900.0   \n",
       "282                                         Srirampura  6 Bedroom      1450.0   \n",
       "299                                         Giri Nagar  3 Bedroom       880.0   \n",
       "...                                                ...        ...         ...   \n",
       "13104                                    Church Street      4 BHK      2920.0   \n",
       "13119                                Sathya Sai Layout  4 Bedroom      6688.0   \n",
       "13126                                    Akshaya Nagar  4 Bedroom      1200.0   \n",
       "13132                            1st Block Koramangala  4 Bedroom      1200.0   \n",
       "13167                                      Benson Town  2 Bedroom      1688.0   \n",
       "13168                                           Ulsoor  2 Bedroom      1160.0   \n",
       "13180                                    Sarakki Nagar      4 BHK      3124.0   \n",
       "13183                                    Shivaji Nagar      2 BHK       600.0   \n",
       "13190                                        Yelahanka  5 Bedroom      1330.0   \n",
       "13197                            Ramakrishnappa Layout  4 Bedroom      9200.0   \n",
       "13198                                   Pattegarhpalya  8 Bedroom      1200.0   \n",
       "13200                                   Defence Colony  6 Bedroom      8000.0   \n",
       "13213                             Rajarajeshwari nagar  4 Bedroom      1200.0   \n",
       "13215                                      Frazer Town  1 Bedroom       896.0   \n",
       "13216                                      Tilak Nagar      1 BHK       250.0   \n",
       "13217                                    T Dasarahalli  6 Bedroom      1200.0   \n",
       "13233                              7th Block Jayanagar      3 BHK      1903.0   \n",
       "13245  12th cross srinivas nagar banshankari 3rd stage      1 BHK      1800.0   \n",
       "13247                            5th Stage BEML Layout  4 Bedroom      1200.0   \n",
       "13261                                Havanur extension  3 Bedroom      2000.0   \n",
       "13262                                    Abshot Layout      2 BHK      1140.0   \n",
       "13277                              Kundalahalli Colony  7 Bedroom      1400.0   \n",
       "13279                          Vishwanatha Nagenahalli  6 Bedroom      1200.0   \n",
       "13290                                   Sarjapur  Road      4 BHK      4050.0   \n",
       "13296                                         Cox Town      2 BHK      1200.0   \n",
       "13305                                         Hulimavu      1 BHK       500.0   \n",
       "13306                            Rajarajeshwari Nagara  4 Bedroom      1200.0   \n",
       "13311                                 Ramamurthy Nagar  7 Bedroom      1500.0   \n",
       "13316                                    Richards Town      4 BHK      3600.0   \n",
       "13318                                  Padmanabhanagar      4 BHK      4689.0   \n",
       "\n",
       "       bath  balcony   price  bhk  price_per_sqft  \n",
       "7       4.0      NaN   600.0    4    18181.818182  \n",
       "9       6.0      NaN   370.0    6    36274.509804  \n",
       "11      5.0      3.0   295.0    4    10592.459605  \n",
       "18      4.0      2.0   290.0    3    10469.314079  \n",
       "22      5.0      2.0   380.0    4    13571.428571  \n",
       "45      9.0      NaN   200.0    8    33333.333333  \n",
       "48      1.0      1.0   130.0    2    16250.000000  \n",
       "57      2.0      2.0   185.0    2    12333.333333  \n",
       "58      4.0      1.0   150.0    6    10660.980810  \n",
       "62      5.0      3.0   650.0    4    11403.508772  \n",
       "70      3.0      2.0   100.0    3    20000.000000  \n",
       "89      6.0      3.0   160.0    6    22535.211268  \n",
       "93      4.0      2.0   155.0    4    12916.666667  \n",
       "107     3.0      2.0   229.0    3    13963.414634  \n",
       "129     7.0      0.0   115.0    7    12105.263158  \n",
       "133     4.0      0.0   210.0    4    17500.000000  \n",
       "149     5.0      NaN   185.0    6    17891.682785  \n",
       "159     4.0      0.0   760.0    4    20266.666667  \n",
       "176     3.0      2.0    85.0    5    14166.666667  \n",
       "185     3.0      2.0   300.0    3    16251.354280  \n",
       "192     5.0      NaN   325.0    4    27083.333333  \n",
       "193     7.0      1.0   250.0    7    13888.888889  \n",
       "209     6.0      0.0   190.0    4    10944.700461  \n",
       "210     4.0      1.0   428.0    4    15017.543860  \n",
       "225     4.0      2.0   260.0    3    10810.810811  \n",
       "258     5.0      NaN   170.0    5    14166.666667  \n",
       "260     3.0      2.0   300.0    4    10344.827586  \n",
       "273     2.0      1.0   110.0    2    12222.222222  \n",
       "282     6.0      0.0   250.0    6    17241.379310  \n",
       "299     3.0      1.0   140.0    3    15909.090909  \n",
       "...     ...      ...     ...  ...             ...  \n",
       "13104   4.0      3.0   536.0    4    18356.164384  \n",
       "13119   6.0      1.0   700.0    4    10466.507177  \n",
       "13126   4.0      2.0   125.0    4    10416.666667  \n",
       "13132   5.0      1.0   350.0    4    29166.666667  \n",
       "13167   2.0      0.0   280.0    2    16587.677725  \n",
       "13168   2.0      1.0   130.0    2    11206.896552  \n",
       "13180   6.0      3.0   349.0    4    11171.574904  \n",
       "13183   1.0      1.0    65.0    2    10833.333333  \n",
       "13190   5.0      0.0   210.0    5    15789.473684  \n",
       "13197   4.0      NaN  2600.0    4    28260.869565  \n",
       "13198   8.0      0.0   140.0    8    11666.666667  \n",
       "13200   6.0      3.0  2800.0    6    35000.000000  \n",
       "13213   5.0      NaN   325.0    4    27083.333333  \n",
       "13215   1.0      0.0   100.0    1    11160.714286  \n",
       "13216   2.0      2.0    40.0    1    16000.000000  \n",
       "13217   3.0      NaN   125.0    6    10416.666667  \n",
       "13233   2.0      1.0   293.0    3    15396.741986  \n",
       "13245   1.0      1.0   200.0    1    11111.111111  \n",
       "13247   5.0      NaN   325.0    4    27083.333333  \n",
       "13261   2.0      2.0   360.0    3    18000.000000  \n",
       "13262   1.0      1.0   185.0    2    16228.070175  \n",
       "13277   7.0      NaN   218.0    7    15571.428571  \n",
       "13279   5.0      NaN   130.0    6    10833.333333  \n",
       "13290   2.0      1.0   450.0    4    11111.111111  \n",
       "13296   2.0      2.0   140.0    2    11666.666667  \n",
       "13305   1.0      3.0   220.0    1    44000.000000  \n",
       "13306   5.0      NaN   325.0    4    27083.333333  \n",
       "13311   9.0      2.0   250.0    7    16666.666667  \n",
       "13316   5.0      NaN   400.0    4    11111.111111  \n",
       "13318   4.0      1.0   488.0    4    10407.336319  \n",
       "\n",
       "[1741 rows x 8 columns]"
      ]
     },
     "execution_count": 24,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df4[df4.price_per_sqft>10000]"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**As a data scientist you will give this report to your business manager for verification. Business manager might say that 4 BHK flat in Rajaji nagar with 6 crore price seems ok and should not be removed. Now you change your criteria further to exclude properties with price_per_sqft < 20000**"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>location</th>\n",
       "      <th>size</th>\n",
       "      <th>total_sqft</th>\n",
       "      <th>bath</th>\n",
       "      <th>balcony</th>\n",
       "      <th>price</th>\n",
       "      <th>bhk</th>\n",
       "      <th>price_per_sqft</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>Gandhi Bazar</td>\n",
       "      <td>6 Bedroom</td>\n",
       "      <td>1020.00</td>\n",
       "      <td>6.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>370.0</td>\n",
       "      <td>6</td>\n",
       "      <td>36274.509804</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>45</th>\n",
       "      <td>HSR Layout</td>\n",
       "      <td>8 Bedroom</td>\n",
       "      <td>600.00</td>\n",
       "      <td>9.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>200.0</td>\n",
       "      <td>8</td>\n",
       "      <td>33333.333333</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>89</th>\n",
       "      <td>Rajaji Nagar</td>\n",
       "      <td>6 Bedroom</td>\n",
       "      <td>710.00</td>\n",
       "      <td>6.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>160.0</td>\n",
       "      <td>6</td>\n",
       "      <td>22535.211268</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>159</th>\n",
       "      <td>Mahalakshmi Layout</td>\n",
       "      <td>4 Bedroom</td>\n",
       "      <td>3750.00</td>\n",
       "      <td>4.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>760.0</td>\n",
       "      <td>4</td>\n",
       "      <td>20266.666667</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>192</th>\n",
       "      <td>Bellandur</td>\n",
       "      <td>4 Bedroom</td>\n",
       "      <td>1200.00</td>\n",
       "      <td>5.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>325.0</td>\n",
       "      <td>4</td>\n",
       "      <td>27083.333333</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>349</th>\n",
       "      <td>Suragajakkanahalli</td>\n",
       "      <td>3 Bedroom</td>\n",
       "      <td>11.00</td>\n",
       "      <td>3.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>74.0</td>\n",
       "      <td>3</td>\n",
       "      <td>672727.272727</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>413</th>\n",
       "      <td>Mahalakshmi Layout</td>\n",
       "      <td>6 Bedroom</td>\n",
       "      <td>1200.00</td>\n",
       "      <td>7.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>250.0</td>\n",
       "      <td>6</td>\n",
       "      <td>20833.333333</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>434</th>\n",
       "      <td>7th Phase JP Nagar</td>\n",
       "      <td>8 Bedroom</td>\n",
       "      <td>1200.00</td>\n",
       "      <td>8.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>250.0</td>\n",
       "      <td>8</td>\n",
       "      <td>20833.333333</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>480</th>\n",
       "      <td>RMV 2nd Stage</td>\n",
       "      <td>4 BHK</td>\n",
       "      <td>1150.00</td>\n",
       "      <td>4.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>260.0</td>\n",
       "      <td>4</td>\n",
       "      <td>22608.695652</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>743</th>\n",
       "      <td>Cunningham Road</td>\n",
       "      <td>4 BHK</td>\n",
       "      <td>5270.00</td>\n",
       "      <td>4.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>1250.0</td>\n",
       "      <td>4</td>\n",
       "      <td>23719.165085</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>770</th>\n",
       "      <td>Sector 3 HSR Layout</td>\n",
       "      <td>9 Bedroom</td>\n",
       "      <td>600.00</td>\n",
       "      <td>9.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>190.0</td>\n",
       "      <td>9</td>\n",
       "      <td>31666.666667</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>861</th>\n",
       "      <td>Indiranagar HAL 2nd Stage</td>\n",
       "      <td>4 Bedroom</td>\n",
       "      <td>2400.00</td>\n",
       "      <td>4.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>640.0</td>\n",
       "      <td>4</td>\n",
       "      <td>26666.666667</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>938</th>\n",
       "      <td>5th Phase JP Nagar</td>\n",
       "      <td>9 Bedroom</td>\n",
       "      <td>1260.00</td>\n",
       "      <td>11.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>290.0</td>\n",
       "      <td>9</td>\n",
       "      <td>23015.873016</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>992</th>\n",
       "      <td>Rajaji Nagar</td>\n",
       "      <td>4 Bedroom</td>\n",
       "      <td>315.00</td>\n",
       "      <td>4.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>90.0</td>\n",
       "      <td>4</td>\n",
       "      <td>28571.428571</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1020</th>\n",
       "      <td>Weavers Colony</td>\n",
       "      <td>1 BHK</td>\n",
       "      <td>15.00</td>\n",
       "      <td>1.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>30.0</td>\n",
       "      <td>1</td>\n",
       "      <td>200000.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1044</th>\n",
       "      <td>Binnamangala</td>\n",
       "      <td>6 Bedroom</td>\n",
       "      <td>3968.00</td>\n",
       "      <td>5.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>900.0</td>\n",
       "      <td>6</td>\n",
       "      <td>22681.451613</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1094</th>\n",
       "      <td>Sector 1 HSR Layout</td>\n",
       "      <td>4 Bedroom</td>\n",
       "      <td>2400.00</td>\n",
       "      <td>5.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>775.0</td>\n",
       "      <td>4</td>\n",
       "      <td>32291.666667</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1103</th>\n",
       "      <td>5th Phase JP Nagar</td>\n",
       "      <td>9 Bedroom</td>\n",
       "      <td>812.00</td>\n",
       "      <td>6.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>165.0</td>\n",
       "      <td>9</td>\n",
       "      <td>20320.197044</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1122</th>\n",
       "      <td>Grihalakshmi Layout</td>\n",
       "      <td>5 Bedroom</td>\n",
       "      <td>24.00</td>\n",
       "      <td>2.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>150.0</td>\n",
       "      <td>5</td>\n",
       "      <td>625000.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1184</th>\n",
       "      <td>Harlur</td>\n",
       "      <td>4 Bedroom</td>\n",
       "      <td>1200.00</td>\n",
       "      <td>4.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>244.0</td>\n",
       "      <td>4</td>\n",
       "      <td>20333.333333</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1269</th>\n",
       "      <td>5th Block Hbr Layout</td>\n",
       "      <td>6 Bedroom</td>\n",
       "      <td>1200.00</td>\n",
       "      <td>6.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>250.0</td>\n",
       "      <td>6</td>\n",
       "      <td>20833.333333</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1299</th>\n",
       "      <td>Chamrajpet</td>\n",
       "      <td>9 Bedroom</td>\n",
       "      <td>4050.00</td>\n",
       "      <td>7.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>1200.0</td>\n",
       "      <td>9</td>\n",
       "      <td>29629.629630</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1311</th>\n",
       "      <td>D Souza Layout</td>\n",
       "      <td>3 BHK</td>\n",
       "      <td>4634.00</td>\n",
       "      <td>4.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>1015.0</td>\n",
       "      <td>3</td>\n",
       "      <td>21903.323263</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1314</th>\n",
       "      <td>Malleshwaram</td>\n",
       "      <td>8 Bedroom</td>\n",
       "      <td>840.00</td>\n",
       "      <td>7.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>195.0</td>\n",
       "      <td>8</td>\n",
       "      <td>23214.285714</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1405</th>\n",
       "      <td>Kodihalli</td>\n",
       "      <td>4 BHK</td>\n",
       "      <td>3073.00</td>\n",
       "      <td>5.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>696.0</td>\n",
       "      <td>4</td>\n",
       "      <td>22648.877319</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1439</th>\n",
       "      <td>9th Block Jayanagar</td>\n",
       "      <td>1 Bedroom</td>\n",
       "      <td>700.00</td>\n",
       "      <td>1.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>150.0</td>\n",
       "      <td>1</td>\n",
       "      <td>21428.571429</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1567</th>\n",
       "      <td>Uttarahalli</td>\n",
       "      <td>5 Bedroom</td>\n",
       "      <td>400.00</td>\n",
       "      <td>5.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>200.0</td>\n",
       "      <td>5</td>\n",
       "      <td>50000.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1669</th>\n",
       "      <td>2nd Stage Nagarbhavi</td>\n",
       "      <td>4 Bedroom</td>\n",
       "      <td>1200.00</td>\n",
       "      <td>4.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>245.0</td>\n",
       "      <td>4</td>\n",
       "      <td>20416.666667</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1678</th>\n",
       "      <td>Whitefield</td>\n",
       "      <td>5 Bedroom</td>\n",
       "      <td>3250.00</td>\n",
       "      <td>5.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>900.0</td>\n",
       "      <td>5</td>\n",
       "      <td>27692.307692</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1727</th>\n",
       "      <td>3rd Block Banashankari</td>\n",
       "      <td>4 Bedroom</td>\n",
       "      <td>1700.00</td>\n",
       "      <td>2.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>550.0</td>\n",
       "      <td>4</td>\n",
       "      <td>32352.941176</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12026</th>\n",
       "      <td>Manjunath Nagar</td>\n",
       "      <td>5 Bedroom</td>\n",
       "      <td>910.00</td>\n",
       "      <td>4.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>194.0</td>\n",
       "      <td>5</td>\n",
       "      <td>21318.681319</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12032</th>\n",
       "      <td>Xavier Layout</td>\n",
       "      <td>3 Bedroom</td>\n",
       "      <td>1524.00</td>\n",
       "      <td>4.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>400.0</td>\n",
       "      <td>3</td>\n",
       "      <td>26246.719160</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12164</th>\n",
       "      <td>Malleshwaram</td>\n",
       "      <td>5 Bedroom</td>\n",
       "      <td>3000.00</td>\n",
       "      <td>4.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>900.0</td>\n",
       "      <td>5</td>\n",
       "      <td>30000.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12198</th>\n",
       "      <td>Nagarbhavi</td>\n",
       "      <td>5 Bedroom</td>\n",
       "      <td>1200.00</td>\n",
       "      <td>5.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>260.0</td>\n",
       "      <td>5</td>\n",
       "      <td>21666.666667</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12209</th>\n",
       "      <td>4th Block Jayanagar</td>\n",
       "      <td>7 Bedroom</td>\n",
       "      <td>2240.00</td>\n",
       "      <td>4.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>700.0</td>\n",
       "      <td>7</td>\n",
       "      <td>31250.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12360</th>\n",
       "      <td>5th Phase JP Nagar</td>\n",
       "      <td>8 Bedroom</td>\n",
       "      <td>1200.00</td>\n",
       "      <td>7.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>250.0</td>\n",
       "      <td>8</td>\n",
       "      <td>20833.333333</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12436</th>\n",
       "      <td>2nd Stage Nagarbhavi</td>\n",
       "      <td>3 Bedroom</td>\n",
       "      <td>600.00</td>\n",
       "      <td>5.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>135.0</td>\n",
       "      <td>3</td>\n",
       "      <td>22500.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12443</th>\n",
       "      <td>Dollars Colony</td>\n",
       "      <td>4 Bedroom</td>\n",
       "      <td>4350.00</td>\n",
       "      <td>8.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2600.0</td>\n",
       "      <td>4</td>\n",
       "      <td>59770.114943</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12449</th>\n",
       "      <td>Indira Nagar</td>\n",
       "      <td>4 Bedroom</td>\n",
       "      <td>2400.00</td>\n",
       "      <td>4.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>700.0</td>\n",
       "      <td>4</td>\n",
       "      <td>29166.666667</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12467</th>\n",
       "      <td>Sector 6 HSR Layout</td>\n",
       "      <td>6 Bedroom</td>\n",
       "      <td>2400.00</td>\n",
       "      <td>5.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>750.0</td>\n",
       "      <td>6</td>\n",
       "      <td>31250.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12483</th>\n",
       "      <td>Koramangala</td>\n",
       "      <td>4 Bedroom</td>\n",
       "      <td>2400.00</td>\n",
       "      <td>5.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>550.0</td>\n",
       "      <td>4</td>\n",
       "      <td>22916.666667</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12508</th>\n",
       "      <td>Electronic City Phase II</td>\n",
       "      <td>1 BHK</td>\n",
       "      <td>1200.00</td>\n",
       "      <td>1.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>295.0</td>\n",
       "      <td>1</td>\n",
       "      <td>24583.333333</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12639</th>\n",
       "      <td>1st Stage Indira Nagar</td>\n",
       "      <td>4 Bedroom</td>\n",
       "      <td>2400.00</td>\n",
       "      <td>4.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>500.0</td>\n",
       "      <td>4</td>\n",
       "      <td>20833.333333</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12724</th>\n",
       "      <td>HAL 2nd Stage</td>\n",
       "      <td>8 Bedroom</td>\n",
       "      <td>1000.00</td>\n",
       "      <td>7.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>260.0</td>\n",
       "      <td>8</td>\n",
       "      <td>26000.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12726</th>\n",
       "      <td>Vasanth nagar</td>\n",
       "      <td>6 Bedroom</td>\n",
       "      <td>2295.00</td>\n",
       "      <td>3.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>650.0</td>\n",
       "      <td>6</td>\n",
       "      <td>28322.440087</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12748</th>\n",
       "      <td>Rajaji Nagar</td>\n",
       "      <td>5 Bedroom</td>\n",
       "      <td>2500.00</td>\n",
       "      <td>4.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>650.0</td>\n",
       "      <td>5</td>\n",
       "      <td>26000.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12753</th>\n",
       "      <td>OMBR Layout</td>\n",
       "      <td>5 Bedroom</td>\n",
       "      <td>600.00</td>\n",
       "      <td>3.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>140.0</td>\n",
       "      <td>5</td>\n",
       "      <td>23333.333333</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12757</th>\n",
       "      <td>Langford Gardens</td>\n",
       "      <td>3 BHK</td>\n",
       "      <td>2777.29</td>\n",
       "      <td>5.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>649.0</td>\n",
       "      <td>3</td>\n",
       "      <td>23368.103439</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12789</th>\n",
       "      <td>Beml layout, Rajarajeshwari nagar</td>\n",
       "      <td>4 Bedroom</td>\n",
       "      <td>1200.00</td>\n",
       "      <td>5.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>325.0</td>\n",
       "      <td>4</td>\n",
       "      <td>27083.333333</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12796</th>\n",
       "      <td>Chikkalasandra</td>\n",
       "      <td>5 Bedroom</td>\n",
       "      <td>1000.00</td>\n",
       "      <td>4.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>300.0</td>\n",
       "      <td>5</td>\n",
       "      <td>30000.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12918</th>\n",
       "      <td>B Channasandra</td>\n",
       "      <td>5 Bedroom</td>\n",
       "      <td>1650.00</td>\n",
       "      <td>5.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>450.0</td>\n",
       "      <td>5</td>\n",
       "      <td>27272.727273</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13019</th>\n",
       "      <td>HAL 2nd Stage</td>\n",
       "      <td>5 Bedroom</td>\n",
       "      <td>2040.00</td>\n",
       "      <td>4.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>500.0</td>\n",
       "      <td>5</td>\n",
       "      <td>24509.803922</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13067</th>\n",
       "      <td>Defence Colony</td>\n",
       "      <td>10 Bedroom</td>\n",
       "      <td>7150.00</td>\n",
       "      <td>13.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>3600.0</td>\n",
       "      <td>10</td>\n",
       "      <td>50349.650350</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13132</th>\n",
       "      <td>1st Block Koramangala</td>\n",
       "      <td>4 Bedroom</td>\n",
       "      <td>1200.00</td>\n",
       "      <td>5.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>350.0</td>\n",
       "      <td>4</td>\n",
       "      <td>29166.666667</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13197</th>\n",
       "      <td>Ramakrishnappa Layout</td>\n",
       "      <td>4 Bedroom</td>\n",
       "      <td>9200.00</td>\n",
       "      <td>4.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2600.0</td>\n",
       "      <td>4</td>\n",
       "      <td>28260.869565</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13200</th>\n",
       "      <td>Defence Colony</td>\n",
       "      <td>6 Bedroom</td>\n",
       "      <td>8000.00</td>\n",
       "      <td>6.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>2800.0</td>\n",
       "      <td>6</td>\n",
       "      <td>35000.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13213</th>\n",
       "      <td>Rajarajeshwari nagar</td>\n",
       "      <td>4 Bedroom</td>\n",
       "      <td>1200.00</td>\n",
       "      <td>5.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>325.0</td>\n",
       "      <td>4</td>\n",
       "      <td>27083.333333</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13247</th>\n",
       "      <td>5th Stage BEML Layout</td>\n",
       "      <td>4 Bedroom</td>\n",
       "      <td>1200.00</td>\n",
       "      <td>5.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>325.0</td>\n",
       "      <td>4</td>\n",
       "      <td>27083.333333</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13305</th>\n",
       "      <td>Hulimavu</td>\n",
       "      <td>1 BHK</td>\n",
       "      <td>500.00</td>\n",
       "      <td>1.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>220.0</td>\n",
       "      <td>1</td>\n",
       "      <td>44000.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13306</th>\n",
       "      <td>Rajarajeshwari Nagara</td>\n",
       "      <td>4 Bedroom</td>\n",
       "      <td>1200.00</td>\n",
       "      <td>5.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>325.0</td>\n",
       "      <td>4</td>\n",
       "      <td>27083.333333</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>236 rows × 8 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                                location        size  total_sqft  bath  \\\n",
       "9                           Gandhi Bazar   6 Bedroom     1020.00   6.0   \n",
       "45                            HSR Layout   8 Bedroom      600.00   9.0   \n",
       "89                          Rajaji Nagar   6 Bedroom      710.00   6.0   \n",
       "159                   Mahalakshmi Layout   4 Bedroom     3750.00   4.0   \n",
       "192                            Bellandur   4 Bedroom     1200.00   5.0   \n",
       "349                   Suragajakkanahalli   3 Bedroom       11.00   3.0   \n",
       "413                   Mahalakshmi Layout   6 Bedroom     1200.00   7.0   \n",
       "434                   7th Phase JP Nagar   8 Bedroom     1200.00   8.0   \n",
       "480                        RMV 2nd Stage       4 BHK     1150.00   4.0   \n",
       "743                      Cunningham Road       4 BHK     5270.00   4.0   \n",
       "770                  Sector 3 HSR Layout   9 Bedroom      600.00   9.0   \n",
       "861            Indiranagar HAL 2nd Stage   4 Bedroom     2400.00   4.0   \n",
       "938                   5th Phase JP Nagar   9 Bedroom     1260.00  11.0   \n",
       "992                         Rajaji Nagar   4 Bedroom      315.00   4.0   \n",
       "1020                      Weavers Colony       1 BHK       15.00   1.0   \n",
       "1044                        Binnamangala   6 Bedroom     3968.00   5.0   \n",
       "1094                 Sector 1 HSR Layout   4 Bedroom     2400.00   5.0   \n",
       "1103                  5th Phase JP Nagar   9 Bedroom      812.00   6.0   \n",
       "1122                 Grihalakshmi Layout   5 Bedroom       24.00   2.0   \n",
       "1184                              Harlur   4 Bedroom     1200.00   4.0   \n",
       "1269                5th Block Hbr Layout   6 Bedroom     1200.00   6.0   \n",
       "1299                          Chamrajpet   9 Bedroom     4050.00   7.0   \n",
       "1311                      D Souza Layout       3 BHK     4634.00   4.0   \n",
       "1314                        Malleshwaram   8 Bedroom      840.00   7.0   \n",
       "1405                           Kodihalli       4 BHK     3073.00   5.0   \n",
       "1439                 9th Block Jayanagar   1 Bedroom      700.00   1.0   \n",
       "1567                         Uttarahalli   5 Bedroom      400.00   5.0   \n",
       "1669                2nd Stage Nagarbhavi   4 Bedroom     1200.00   4.0   \n",
       "1678                          Whitefield   5 Bedroom     3250.00   5.0   \n",
       "1727              3rd Block Banashankari   4 Bedroom     1700.00   2.0   \n",
       "...                                  ...         ...         ...   ...   \n",
       "12026                    Manjunath Nagar   5 Bedroom      910.00   4.0   \n",
       "12032                      Xavier Layout   3 Bedroom     1524.00   4.0   \n",
       "12164                       Malleshwaram   5 Bedroom     3000.00   4.0   \n",
       "12198                         Nagarbhavi   5 Bedroom     1200.00   5.0   \n",
       "12209                4th Block Jayanagar   7 Bedroom     2240.00   4.0   \n",
       "12360                 5th Phase JP Nagar   8 Bedroom     1200.00   7.0   \n",
       "12436               2nd Stage Nagarbhavi   3 Bedroom      600.00   5.0   \n",
       "12443                     Dollars Colony   4 Bedroom     4350.00   8.0   \n",
       "12449                       Indira Nagar   4 Bedroom     2400.00   4.0   \n",
       "12467                Sector 6 HSR Layout   6 Bedroom     2400.00   5.0   \n",
       "12483                        Koramangala   4 Bedroom     2400.00   5.0   \n",
       "12508           Electronic City Phase II       1 BHK     1200.00   1.0   \n",
       "12639             1st Stage Indira Nagar   4 Bedroom     2400.00   4.0   \n",
       "12724                      HAL 2nd Stage   8 Bedroom     1000.00   7.0   \n",
       "12726                      Vasanth nagar   6 Bedroom     2295.00   3.0   \n",
       "12748                       Rajaji Nagar   5 Bedroom     2500.00   4.0   \n",
       "12753                        OMBR Layout   5 Bedroom      600.00   3.0   \n",
       "12757                   Langford Gardens       3 BHK     2777.29   5.0   \n",
       "12789  Beml layout, Rajarajeshwari nagar   4 Bedroom     1200.00   5.0   \n",
       "12796                     Chikkalasandra   5 Bedroom     1000.00   4.0   \n",
       "12918                     B Channasandra   5 Bedroom     1650.00   5.0   \n",
       "13019                      HAL 2nd Stage   5 Bedroom     2040.00   4.0   \n",
       "13067                     Defence Colony  10 Bedroom     7150.00  13.0   \n",
       "13132              1st Block Koramangala   4 Bedroom     1200.00   5.0   \n",
       "13197              Ramakrishnappa Layout   4 Bedroom     9200.00   4.0   \n",
       "13200                     Defence Colony   6 Bedroom     8000.00   6.0   \n",
       "13213               Rajarajeshwari nagar   4 Bedroom     1200.00   5.0   \n",
       "13247              5th Stage BEML Layout   4 Bedroom     1200.00   5.0   \n",
       "13305                           Hulimavu       1 BHK      500.00   1.0   \n",
       "13306              Rajarajeshwari Nagara   4 Bedroom     1200.00   5.0   \n",
       "\n",
       "       balcony   price  bhk  price_per_sqft  \n",
       "9          NaN   370.0    6    36274.509804  \n",
       "45         NaN   200.0    8    33333.333333  \n",
       "89         3.0   160.0    6    22535.211268  \n",
       "159        0.0   760.0    4    20266.666667  \n",
       "192        NaN   325.0    4    27083.333333  \n",
       "349        2.0    74.0    3   672727.272727  \n",
       "413        3.0   250.0    6    20833.333333  \n",
       "434        NaN   250.0    8    20833.333333  \n",
       "480        2.0   260.0    4    22608.695652  \n",
       "743        3.0  1250.0    4    23719.165085  \n",
       "770        3.0   190.0    9    31666.666667  \n",
       "861        1.0   640.0    4    26666.666667  \n",
       "938        NaN   290.0    9    23015.873016  \n",
       "992        2.0    90.0    4    28571.428571  \n",
       "1020       0.0    30.0    1   200000.000000  \n",
       "1044       2.0   900.0    6    22681.451613  \n",
       "1094       NaN   775.0    4    32291.666667  \n",
       "1103       3.0   165.0    9    20320.197044  \n",
       "1122       2.0   150.0    5   625000.000000  \n",
       "1184       NaN   244.0    4    20333.333333  \n",
       "1269       2.0   250.0    6    20833.333333  \n",
       "1299       1.0  1200.0    9    29629.629630  \n",
       "1311       3.0  1015.0    3    21903.323263  \n",
       "1314       2.0   195.0    8    23214.285714  \n",
       "1405       2.0   696.0    4    22648.877319  \n",
       "1439       0.0   150.0    1    21428.571429  \n",
       "1567       1.0   200.0    5    50000.000000  \n",
       "1669       2.0   245.0    4    20416.666667  \n",
       "1678       3.0   900.0    5    27692.307692  \n",
       "1727       1.0   550.0    4    32352.941176  \n",
       "...        ...     ...  ...             ...  \n",
       "12026      2.0   194.0    5    21318.681319  \n",
       "12032      2.0   400.0    3    26246.719160  \n",
       "12164      0.0   900.0    5    30000.000000  \n",
       "12198      1.0   260.0    5    21666.666667  \n",
       "12209      1.0   700.0    7    31250.000000  \n",
       "12360      3.0   250.0    8    20833.333333  \n",
       "12436      1.0   135.0    3    22500.000000  \n",
       "12443      NaN  2600.0    4    59770.114943  \n",
       "12449      1.0   700.0    4    29166.666667  \n",
       "12467      2.0   750.0    6    31250.000000  \n",
       "12483      3.0   550.0    4    22916.666667  \n",
       "12508      0.0   295.0    1    24583.333333  \n",
       "12639      1.0   500.0    4    20833.333333  \n",
       "12724      3.0   260.0    8    26000.000000  \n",
       "12726      0.0   650.0    6    28322.440087  \n",
       "12748      0.0   650.0    5    26000.000000  \n",
       "12753      0.0   140.0    5    23333.333333  \n",
       "12757      2.0   649.0    3    23368.103439  \n",
       "12789      NaN   325.0    4    27083.333333  \n",
       "12796      2.0   300.0    5    30000.000000  \n",
       "12918      1.0   450.0    5    27272.727273  \n",
       "13019      1.0   500.0    5    24509.803922  \n",
       "13067      NaN  3600.0   10    50349.650350  \n",
       "13132      1.0   350.0    4    29166.666667  \n",
       "13197      NaN  2600.0    4    28260.869565  \n",
       "13200      3.0  2800.0    6    35000.000000  \n",
       "13213      NaN   325.0    4    27083.333333  \n",
       "13247      NaN   325.0    4    27083.333333  \n",
       "13305      3.0   220.0    1    44000.000000  \n",
       "13306      NaN   325.0    4    27083.333333  \n",
       "\n",
       "[236 rows x 8 columns]"
      ]
     },
     "execution_count": 25,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df4[df4.price_per_sqft>20000]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(array([   9.,   21.,  496., 1955., 2935., 2519., 1636., 1003.,  556.,\n",
       "         309.,  346.,  224.,  212.,  176.,  132.,  150.,  120.,   71.,\n",
       "          71.]),\n",
       " array([    0,  1000,  2000,  3000,  4000,  5000,  6000,  7000,  8000,\n",
       "         9000, 10000, 11000, 12000, 13000, 14000, 15000, 16000, 17000,\n",
       "        18000, 19000]),\n",
       " <a list of 19 Patch objects>)"
      ]
     },
     "execution_count": 26,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAZgAAAEKCAYAAAAvlUMdAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4zLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvnQurowAAGZNJREFUeJzt3XuwZWV95vHvIwgab4AcKeSSRm0zYioiaZGIZogmguAEzYjBsiIqM60GHG/JVBunooljFcYLxtHgYOwRLBXwVnaABFs0RmcUaBCQFgkttNLCAAoixpQZyG/+WO8Jm+O5dfd+z62/n6pde+13vWvt31r79H56XfZaqSokSRq3By12AZKklcmAkSR1YcBIkrowYCRJXRgwkqQuDBhJUhcGjCSpCwNGktSFASNJ6mL3xS6gh3333bdWrVq12GVI0rJyxRVX/LCqJsY1vxUZMKtWrWLTpk2LXYYkLStJvjfO+XXbRZbkIUkuS3J1ks1J/qy1H5Lk0iQ3JDkvyR6tfc/2eksbv2pkXm9u7dcnOaZXzZKk8el5DObnwLOr6inAYcCxSY4E3gmcUVWrgbuAU1r/U4C7quoJwBmtH0kOBU4CngwcC/xVkt061i1JGoNuAVODn7aXD26PAp4NfLq1nw28oA2f0F7Txj8nSVr7uVX186q6CdgCHNGrbknSeHQ9iyzJbkmuAm4HNgLfBX5cVfe2LtuAA9rwAcDNAG383cCjR9unmUaStER1DZiquq+qDgMOZNjqeNJ03dpzZhg3U/sDJFmbZFOSTXfccceOlixJGpMF+R1MVf0Y+HvgSGCvJJNnrx0I3NKGtwEHAbTxjwLuHG2fZprR9zirqtZU1ZqJibGdZSdJ2kE9zyKbSLJXG34o8NvAdcCXgRe1bicDn2/DG9pr2vgv1XC7zQ3ASe0ss0OA1cBlveqWJI1Hz9/B7A+c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A/Ap5WVXcl+ejkuGayhgcx3P/kAetrnmabdtp1l+2/i7N2MR6D0UpzCcP/9h8Nwz3JW/sXgNH/sW/Pl/DFwGva5dBJ8sR2EsCMkjw2I/c5Z7i3yfeq6sfA3Ume2dpfOtJnK3BYkgclOYj7L1P/SIYQuTvJfsywxVPD/T9uSnJiqyFJnjKfBZxj2pnW3T0Mt+eVpmXAaEWpqs3AO4CvJLma+884+y/AmnaQ/tsMB6jn668ZLnF/ZTsg/z+Ze+v/wcC7k3yn7eL7feB1bdwrgA8m+TowulXwvxkuj/4t4N0MJzBQVVcD32S4Qu/61m8mLwVOacu+me27LfRM08607v4GeKEH+TUTr6YsLaJ2NtYFVfWri1yKNHZuwUiSunALRpLUhVswkqQuDBhJUhcGjCSpCwNGktSFASNJ6sKAkSR18f8BwQ9OAdn9M9kAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "df5 = df4[~(df4.price_per_sqft>20000)]\n",
    "max_price_per_sqft = int(max(df5['price_per_sqft']))\n",
    "b = range(0,max_price_per_sqft,1000)\n",
    "\n",
    "plt.xlabel('Price Per Square Feet')\n",
    "plt.ylabel('Count')\n",
    "plt.hist(df5.price_per_sqft,bins=b, rwidth=0.5,align='right')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**Your business manager tells you that on the lower side, anything less than 2000 rs per square ft looks suspicious. He asks you to give report of such properties and you generate it as show below**"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>location</th>\n",
       "      <th>size</th>\n",
       "      <th>total_sqft</th>\n",
       "      <th>bath</th>\n",
       "      <th>balcony</th>\n",
       "      <th>price</th>\n",
       "      <th>bhk</th>\n",
       "      <th>price_per_sqft</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>132</th>\n",
       "      <td>Electronic City</td>\n",
       "      <td>2 BHK</td>\n",
       "      <td>880.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>16.5</td>\n",
       "      <td>2</td>\n",
       "      <td>1875.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>514</th>\n",
       "      <td>Banashankari Stage III</td>\n",
       "      <td>4 Bedroom</td>\n",
       "      <td>8500.0</td>\n",
       "      <td>4.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>145.0</td>\n",
       "      <td>4</td>\n",
       "      <td>1705.882353</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>674</th>\n",
       "      <td>Yelahanka</td>\n",
       "      <td>3 BHK</td>\n",
       "      <td>35000.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>130.0</td>\n",
       "      <td>3</td>\n",
       "      <td>371.428571</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>810</th>\n",
       "      <td>4 Bedroom Farm House in Bagalur</td>\n",
       "      <td>4 Bedroom</td>\n",
       "      <td>10961.0</td>\n",
       "      <td>4.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>80.0</td>\n",
       "      <td>4</td>\n",
       "      <td>729.860414</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>996</th>\n",
       "      <td>Chikkabanavar</td>\n",
       "      <td>1 Bedroom</td>\n",
       "      <td>1200.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>20.0</td>\n",
       "      <td>1</td>\n",
       "      <td>1666.666667</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1894</th>\n",
       "      <td>Nelamangala</td>\n",
       "      <td>3 Bedroom</td>\n",
       "      <td>52272.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>140.0</td>\n",
       "      <td>3</td>\n",
       "      <td>267.829813</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2404</th>\n",
       "      <td>Yelahanka New Town</td>\n",
       "      <td>1 BHK</td>\n",
       "      <td>960.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>18.0</td>\n",
       "      <td>1</td>\n",
       "      <td>1875.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2421</th>\n",
       "      <td>Basavanagara</td>\n",
       "      <td>4 Bedroom</td>\n",
       "      <td>2000.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>25.0</td>\n",
       "      <td>4</td>\n",
       "      <td>1250.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3976</th>\n",
       "      <td>Chikkathoguru</td>\n",
       "      <td>1 BHK</td>\n",
       "      <td>1500.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>19.5</td>\n",
       "      <td>1</td>\n",
       "      <td>1300.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4105</th>\n",
       "      <td>Indranagar  100ft road defence colony</td>\n",
       "      <td>5 BHK</td>\n",
       "      <td>5800.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>80.0</td>\n",
       "      <td>5</td>\n",
       "      <td>1379.310345</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4548</th>\n",
       "      <td>Channasandra</td>\n",
       "      <td>2 Bedroom</td>\n",
       "      <td>3040.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>48.0</td>\n",
       "      <td>2</td>\n",
       "      <td>1578.947368</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5393</th>\n",
       "      <td>Doddabommasandra</td>\n",
       "      <td>9 BHK</td>\n",
       "      <td>42000.0</td>\n",
       "      <td>8.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>175.0</td>\n",
       "      <td>9</td>\n",
       "      <td>416.666667</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5469</th>\n",
       "      <td>Ulsoor</td>\n",
       "      <td>4 BHK</td>\n",
       "      <td>36000.0</td>\n",
       "      <td>4.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>450.0</td>\n",
       "      <td>4</td>\n",
       "      <td>1250.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5652</th>\n",
       "      <td>JP Nagar</td>\n",
       "      <td>2 BHK</td>\n",
       "      <td>1100.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>15.0</td>\n",
       "      <td>2</td>\n",
       "      <td>1363.636364</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7077</th>\n",
       "      <td>Gollahalli</td>\n",
       "      <td>2 BHK</td>\n",
       "      <td>1600.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>31.0</td>\n",
       "      <td>2</td>\n",
       "      <td>1937.500000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7242</th>\n",
       "      <td>Yelahanka</td>\n",
       "      <td>1 Bedroom</td>\n",
       "      <td>26136.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>150.0</td>\n",
       "      <td>1</td>\n",
       "      <td>573.921028</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7272</th>\n",
       "      <td>Yelahanka</td>\n",
       "      <td>1 Bedroom</td>\n",
       "      <td>1075.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>19.5</td>\n",
       "      <td>1</td>\n",
       "      <td>1813.953488</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7947</th>\n",
       "      <td>JP Nagar</td>\n",
       "      <td>3 BHK</td>\n",
       "      <td>20000.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>175.0</td>\n",
       "      <td>3</td>\n",
       "      <td>875.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7961</th>\n",
       "      <td>Hegde Nagar</td>\n",
       "      <td>4 BHK</td>\n",
       "      <td>2600.0</td>\n",
       "      <td>4.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>40.0</td>\n",
       "      <td>4</td>\n",
       "      <td>1538.461538</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8391</th>\n",
       "      <td>Kengeri</td>\n",
       "      <td>1 BHK</td>\n",
       "      <td>1200.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>14.0</td>\n",
       "      <td>1</td>\n",
       "      <td>1166.666667</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8541</th>\n",
       "      <td>AMS Layout</td>\n",
       "      <td>1 BHK</td>\n",
       "      <td>1000.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>19.0</td>\n",
       "      <td>1</td>\n",
       "      <td>1900.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8653</th>\n",
       "      <td>Doddaballapur</td>\n",
       "      <td>2 Bedroom</td>\n",
       "      <td>640.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>10.5</td>\n",
       "      <td>2</td>\n",
       "      <td>1640.625000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8743</th>\n",
       "      <td>Nayandanahalli</td>\n",
       "      <td>7 Bedroom</td>\n",
       "      <td>6500.0</td>\n",
       "      <td>7.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>104.0</td>\n",
       "      <td>7</td>\n",
       "      <td>1600.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8922</th>\n",
       "      <td>Electronic City</td>\n",
       "      <td>2 BHK</td>\n",
       "      <td>1200.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>20.0</td>\n",
       "      <td>2</td>\n",
       "      <td>1666.666667</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9240</th>\n",
       "      <td>SARJAPUR BAGALUR ROAD</td>\n",
       "      <td>4 Bedroom</td>\n",
       "      <td>10961.0</td>\n",
       "      <td>4.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>80.0</td>\n",
       "      <td>4</td>\n",
       "      <td>729.860414</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9374</th>\n",
       "      <td>Yelahanka</td>\n",
       "      <td>1 BHK</td>\n",
       "      <td>1000.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>14.0</td>\n",
       "      <td>1</td>\n",
       "      <td>1400.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10075</th>\n",
       "      <td>Yelahanka,MVIT college</td>\n",
       "      <td>1 Bedroom</td>\n",
       "      <td>10030.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>150.0</td>\n",
       "      <td>1</td>\n",
       "      <td>1495.513460</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11748</th>\n",
       "      <td>Begur</td>\n",
       "      <td>3 BHK</td>\n",
       "      <td>2400.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>12.0</td>\n",
       "      <td>3</td>\n",
       "      <td>500.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12470</th>\n",
       "      <td>Nagashetty Halli</td>\n",
       "      <td>4 BHK</td>\n",
       "      <td>16335.0</td>\n",
       "      <td>4.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>149.0</td>\n",
       "      <td>4</td>\n",
       "      <td>912.151821</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12570</th>\n",
       "      <td>Bommasandra Industrial Area</td>\n",
       "      <td>2 BHK</td>\n",
       "      <td>7000.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>135.0</td>\n",
       "      <td>2</td>\n",
       "      <td>1928.571429</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                                    location       size  total_sqft  bath  \\\n",
       "132                          Electronic City      2 BHK       880.0   1.0   \n",
       "514                   Banashankari Stage III  4 Bedroom      8500.0   4.0   \n",
       "674                                Yelahanka      3 BHK     35000.0   3.0   \n",
       "810          4 Bedroom Farm House in Bagalur  4 Bedroom     10961.0   4.0   \n",
       "996                            Chikkabanavar  1 Bedroom      1200.0   1.0   \n",
       "1894                             Nelamangala  3 Bedroom     52272.0   2.0   \n",
       "2404                      Yelahanka New Town      1 BHK       960.0   2.0   \n",
       "2421                            Basavanagara  4 Bedroom      2000.0   3.0   \n",
       "3976                           Chikkathoguru      1 BHK      1500.0   1.0   \n",
       "4105   Indranagar  100ft road defence colony      5 BHK      5800.0   5.0   \n",
       "4548                            Channasandra  2 Bedroom      3040.0   2.0   \n",
       "5393                        Doddabommasandra      9 BHK     42000.0   8.0   \n",
       "5469                                  Ulsoor      4 BHK     36000.0   4.0   \n",
       "5652                                JP Nagar      2 BHK      1100.0   1.0   \n",
       "7077                              Gollahalli      2 BHK      1600.0   2.0   \n",
       "7242                               Yelahanka  1 Bedroom     26136.0   1.0   \n",
       "7272                               Yelahanka  1 Bedroom      1075.0   1.0   \n",
       "7947                                JP Nagar      3 BHK     20000.0   3.0   \n",
       "7961                             Hegde Nagar      4 BHK      2600.0   4.0   \n",
       "8391                                 Kengeri      1 BHK      1200.0   1.0   \n",
       "8541                              AMS Layout      1 BHK      1000.0   1.0   \n",
       "8653                           Doddaballapur  2 Bedroom       640.0   1.0   \n",
       "8743                          Nayandanahalli  7 Bedroom      6500.0   7.0   \n",
       "8922                         Electronic City      2 BHK      1200.0   2.0   \n",
       "9240                   SARJAPUR BAGALUR ROAD  4 Bedroom     10961.0   4.0   \n",
       "9374                               Yelahanka      1 BHK      1000.0   1.0   \n",
       "10075                 Yelahanka,MVIT college  1 Bedroom     10030.0   1.0   \n",
       "11748                                  Begur      3 BHK      2400.0   3.0   \n",
       "12470                       Nagashetty Halli      4 BHK     16335.0   4.0   \n",
       "12570            Bommasandra Industrial Area      2 BHK      7000.0   2.0   \n",
       "\n",
       "       balcony  price  bhk  price_per_sqft  \n",
       "132        1.0   16.5    2     1875.000000  \n",
       "514        2.0  145.0    4     1705.882353  \n",
       "674        3.0  130.0    3      371.428571  \n",
       "810        1.0   80.0    4      729.860414  \n",
       "996        0.0   20.0    1     1666.666667  \n",
       "1894       1.0  140.0    3      267.829813  \n",
       "2404       1.0   18.0    1     1875.000000  \n",
       "2421       2.0   25.0    4     1250.000000  \n",
       "3976       1.0   19.5    1     1300.000000  \n",
       "4105       NaN   80.0    5     1379.310345  \n",
       "4548       1.0   48.0    2     1578.947368  \n",
       "5393       3.0  175.0    9      416.666667  \n",
       "5469       2.0  450.0    4     1250.000000  \n",
       "5652       1.0   15.0    2     1363.636364  \n",
       "7077       1.0   31.0    2     1937.500000  \n",
       "7242       0.0  150.0    1      573.921028  \n",
       "7272       0.0   19.5    1     1813.953488  \n",
       "7947       NaN  175.0    3      875.000000  \n",
       "7961       3.0   40.0    4     1538.461538  \n",
       "8391       1.0   14.0    1     1166.666667  \n",
       "8541       1.0   19.0    1     1900.000000  \n",
       "8653       0.0   10.5    2     1640.625000  \n",
       "8743       1.0  104.0    7     1600.000000  \n",
       "8922       1.0   20.0    2     1666.666667  \n",
       "9240       1.0   80.0    4      729.860414  \n",
       "9374       0.0   14.0    1     1400.000000  \n",
       "10075      1.0  150.0    1     1495.513460  \n",
       "11748      2.0   12.0    3      500.000000  \n",
       "12470      2.0  149.0    4      912.151821  \n",
       "12570      1.0  135.0    2     1928.571429  "
      ]
     },
     "execution_count": 27,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df5[df5.price_per_sqft<2000]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(12991, 8)"
      ]
     },
     "execution_count": 28,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df6 = df5[~(df5.price_per_sqft<2000)]\n",
    "df6.shape"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<h2 style=\"color:purple\">Lets check BHK feature now</h2>"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(array([0.000e+00, 6.270e+02, 5.504e+03, 4.811e+03, 1.307e+03, 3.160e+02,\n",
       "        1.960e+02, 9.200e+01, 7.400e+01, 4.300e+01, 1.100e+01, 4.000e+00,\n",
       "        1.000e+00, 1.000e+00, 1.000e+00, 0.000e+00, 1.000e+00, 0.000e+00,\n",
       "        1.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,\n",
       "        0.000e+00, 0.000e+00]),\n",
       " array([ 0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14, 15, 16,\n",
       "        17, 18, 19, 20, 21, 22, 23, 24, 25, 26]),\n",
       " <a list of 26 Patch objects>)"
      ]
     },
     "execution_count": 29,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAY4AAAEKCAYAAAAFJbKyAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29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ure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.xlabel('BHK')\n",
    "plt.ylabel('Count')\n",
    "plt.hist(df6.bhk,bins=range(0,max(df6.bhk)), rwidth=0.5, align='right')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>location</th>\n",
       "      <th>size</th>\n",
       "      <th>total_sqft</th>\n",
       "      <th>bath</th>\n",
       "      <th>balcony</th>\n",
       "      <th>price</th>\n",
       "      <th>bhk</th>\n",
       "      <th>price_per_sqft</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>459</th>\n",
       "      <td>1 Giri Nagar</td>\n",
       "      <td>11 BHK</td>\n",
       "      <td>5000.0</td>\n",
       "      <td>9.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>360.0</td>\n",
       "      <td>11</td>\n",
       "      <td>7200.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1718</th>\n",
       "      <td>2Electronic City Phase II</td>\n",
       "      <td>27 BHK</td>\n",
       "      <td>8000.0</td>\n",
       "      <td>27.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>230.0</td>\n",
       "      <td>27</td>\n",
       "      <td>2875.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1768</th>\n",
       "      <td>1 Ramamurthy Nagar</td>\n",
       "      <td>11 Bedroom</td>\n",
       "      <td>1200.0</td>\n",
       "      <td>11.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>170.0</td>\n",
       "      <td>11</td>\n",
       "      <td>14166.666667</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3609</th>\n",
       "      <td>Koramangala Industrial Layout</td>\n",
       "      <td>16 BHK</td>\n",
       "      <td>10000.0</td>\n",
       "      <td>16.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>550.0</td>\n",
       "      <td>16</td>\n",
       "      <td>5500.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3853</th>\n",
       "      <td>1 Annasandrapalya</td>\n",
       "      <td>11 Bedroom</td>\n",
       "      <td>1200.0</td>\n",
       "      <td>6.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>150.0</td>\n",
       "      <td>11</td>\n",
       "      <td>12500.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4916</th>\n",
       "      <td>1Channasandra</td>\n",
       "      <td>14 BHK</td>\n",
       "      <td>1250.0</td>\n",
       "      <td>15.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>125.0</td>\n",
       "      <td>14</td>\n",
       "      <td>10000.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6533</th>\n",
       "      <td>Mysore Road</td>\n",
       "      <td>12 Bedroom</td>\n",
       "      <td>2232.0</td>\n",
       "      <td>6.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>300.0</td>\n",
       "      <td>12</td>\n",
       "      <td>13440.860215</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7979</th>\n",
       "      <td>1 Immadihalli</td>\n",
       "      <td>11 BHK</td>\n",
       "      <td>6000.0</td>\n",
       "      <td>12.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>150.0</td>\n",
       "      <td>11</td>\n",
       "      <td>2500.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9935</th>\n",
       "      <td>1Hoysalanagar</td>\n",
       "      <td>13 BHK</td>\n",
       "      <td>5425.0</td>\n",
       "      <td>13.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>275.0</td>\n",
       "      <td>13</td>\n",
       "      <td>5069.124424</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11559</th>\n",
       "      <td>1Kasavanhalli</td>\n",
       "      <td>18 Bedroom</td>\n",
       "      <td>1200.0</td>\n",
       "      <td>18.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>200.0</td>\n",
       "      <td>18</td>\n",
       "      <td>16666.666667</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                            location        size  total_sqft  bath  balcony  \\\n",
       "459                     1 Giri Nagar      11 BHK      5000.0   9.0      3.0   \n",
       "1718       2Electronic City Phase II      27 BHK      8000.0  27.0      0.0   \n",
       "1768              1 Ramamurthy Nagar  11 Bedroom      1200.0  11.0      0.0   \n",
       "3609   Koramangala Industrial Layout      16 BHK     10000.0  16.0      NaN   \n",
       "3853               1 Annasandrapalya  11 Bedroom      1200.0   6.0      3.0   \n",
       "4916                   1Channasandra      14 BHK      1250.0  15.0      0.0   \n",
       "6533                     Mysore Road  12 Bedroom      2232.0   6.0      2.0   \n",
       "7979                   1 Immadihalli      11 BHK      6000.0  12.0      NaN   \n",
       "9935                   1Hoysalanagar      13 BHK      5425.0  13.0      0.0   \n",
       "11559                  1Kasavanhalli  18 Bedroom      1200.0  18.0      NaN   \n",
       "\n",
       "       price  bhk  price_per_sqft  \n",
       "459    360.0   11     7200.000000  \n",
       "1718   230.0   27     2875.000000  \n",
       "1768   170.0   11    14166.666667  \n",
       "3609   550.0   16     5500.000000  \n",
       "3853   150.0   11    12500.000000  \n",
       "4916   125.0   14    10000.000000  \n",
       "6533   300.0   12    13440.860215  \n",
       "7979   150.0   11     2500.000000  \n",
       "9935   275.0   13     5069.124424  \n",
       "11559  200.0   18    16666.666667  "
      ]
     },
     "execution_count": 30,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df6[df6.bhk>10]"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**Your business manager who is real estate expert tells you that general norm is to have 3 BHK per 1000 square ft. Based on thiis criteria you can detect outliers in that dataset**"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>location</th>\n",
       "      <th>size</th>\n",
       "      <th>total_sqft</th>\n",
       "      <th>bath</th>\n",
       "      <th>balcony</th>\n",
       "      <th>price</th>\n",
       "      <th>bhk</th>\n",
       "      <th>price_per_sqft</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>26</th>\n",
       "      <td>Electronic City</td>\n",
       "      <td>2 BHK</td>\n",
       "      <td>660.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>23.10</td>\n",
       "      <td>2</td>\n",
       "      <td>3500.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>58</th>\n",
       "      <td>Murugeshpalya</td>\n",
       "      <td>6 Bedroom</td>\n",
       "      <td>1407.0</td>\n",
       "      <td>4.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>150.00</td>\n",
       "      <td>6</td>\n",
       "      <td>10660.980810</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>68</th>\n",
       "      <td>Devarachikkanahalli</td>\n",
       "      <td>8 Bedroom</td>\n",
       "      <td>1350.0</td>\n",
       "      <td>7.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>85.00</td>\n",
       "      <td>8</td>\n",
       "      <td>6296.296296</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>70</th>\n",
       "      <td>Double Road</td>\n",
       "      <td>3 Bedroom</td>\n",
       "      <td>500.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>100.00</td>\n",
       "      <td>3</td>\n",
       "      <td>20000.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>78</th>\n",
       "      <td>Kaval Byrasandra</td>\n",
       "      <td>2 BHK</td>\n",
       "      <td>460.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>22.00</td>\n",
       "      <td>2</td>\n",
       "      <td>4782.608696</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>93</th>\n",
       "      <td>ISRO Layout</td>\n",
       "      <td>4 Bedroom</td>\n",
       "      <td>1200.0</td>\n",
       "      <td>4.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>155.00</td>\n",
       "      <td>4</td>\n",
       "      <td>12916.666667</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>101</th>\n",
       "      <td>Chandapura</td>\n",
       "      <td>2 BHK</td>\n",
       "      <td>650.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>17.00</td>\n",
       "      <td>2</td>\n",
       "      <td>2615.384615</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>119</th>\n",
       "      <td>Hennur Road</td>\n",
       "      <td>2 Bedroom</td>\n",
       "      <td>276.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>23.00</td>\n",
       "      <td>2</td>\n",
       "      <td>8333.333333</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>129</th>\n",
       "      <td>Vishwapriya Layout</td>\n",
       "      <td>7 Bedroom</td>\n",
       "      <td>950.0</td>\n",
       "      <td>7.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>115.00</td>\n",
       "      <td>7</td>\n",
       "      <td>12105.263158</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>133</th>\n",
       "      <td>Ramaswamy Palya - Kammanahalli Main Road</td>\n",
       "      <td>4 Bedroom</td>\n",
       "      <td>1200.0</td>\n",
       "      <td>4.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>210.00</td>\n",
       "      <td>4</td>\n",
       "      <td>17500.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>149</th>\n",
       "      <td>Dinnur</td>\n",
       "      <td>6 Bedroom</td>\n",
       "      <td>1034.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>185.00</td>\n",
       "      <td>6</td>\n",
       "      <td>17891.682785</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>170</th>\n",
       "      <td>Kothnur Narayanapura</td>\n",
       "      <td>6 BHK</td>\n",
       "      <td>1300.0</td>\n",
       "      <td>6.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>99.00</td>\n",
       "      <td>6</td>\n",
       "      <td>7615.384615</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>176</th>\n",
       "      <td>Kumaraswami Layout</td>\n",
       "      <td>5 Bedroom</td>\n",
       "      <td>600.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>85.00</td>\n",
       "      <td>5</td>\n",
       "      <td>14166.666667</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>193</th>\n",
       "      <td>Ejipura</td>\n",
       "      <td>7 Bedroom</td>\n",
       "      <td>1800.0</td>\n",
       "      <td>7.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>250.00</td>\n",
       "      <td>7</td>\n",
       "      <td>13888.888889</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>201</th>\n",
       "      <td>Langford Town</td>\n",
       "      <td>3 BHK</td>\n",
       "      <td>912.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>70.00</td>\n",
       "      <td>3</td>\n",
       "      <td>7675.438596</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>241</th>\n",
       "      <td>Mukkutam Nagar</td>\n",
       "      <td>8 Bedroom</td>\n",
       "      <td>2600.0</td>\n",
       "      <td>8.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>180.00</td>\n",
       "      <td>8</td>\n",
       "      <td>6923.076923</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>255</th>\n",
       "      <td>Horamavu Agara</td>\n",
       "      <td>4 Bedroom</td>\n",
       "      <td>1200.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>95.00</td>\n",
       "      <td>4</td>\n",
       "      <td>7916.666667</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>258</th>\n",
       "      <td>MCECHS  layout</td>\n",
       "      <td>5 Bedroom</td>\n",
       "      <td>1200.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>170.00</td>\n",
       "      <td>5</td>\n",
       "      <td>14166.666667</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>282</th>\n",
       "      <td>Srirampura</td>\n",
       "      <td>6 Bedroom</td>\n",
       "      <td>1450.0</td>\n",
       "      <td>6.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>250.00</td>\n",
       "      <td>6</td>\n",
       "      <td>17241.379310</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>299</th>\n",
       "      <td>Giri Nagar</td>\n",
       "      <td>3 Bedroom</td>\n",
       "      <td>880.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>140.00</td>\n",
       "      <td>3</td>\n",
       "      <td>15909.090909</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>315</th>\n",
       "      <td>Srirampura</td>\n",
       "      <td>5 Bedroom</td>\n",
       "      <td>1200.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>180.00</td>\n",
       "      <td>5</td>\n",
       "      <td>15000.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>323</th>\n",
       "      <td>Akshaya Vana</td>\n",
       "      <td>4 Bedroom</td>\n",
       "      <td>1200.0</td>\n",
       "      <td>4.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>165.00</td>\n",
       "      <td>4</td>\n",
       "      <td>13750.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>397</th>\n",
       "      <td>K N Extension</td>\n",
       "      <td>6 BHK</td>\n",
       "      <td>700.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>120.00</td>\n",
       "      <td>6</td>\n",
       "      <td>17142.857143</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>403</th>\n",
       "      <td>Gokula Extension</td>\n",
       "      <td>4 BHK</td>\n",
       "      <td>1200.0</td>\n",
       "      <td>4.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>175.00</td>\n",
       "      <td>4</td>\n",
       "      <td>14583.333333</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>406</th>\n",
       "      <td>Bannerghatta Road</td>\n",
       "      <td>4 Bedroom</td>\n",
       "      <td>1200.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>125.00</td>\n",
       "      <td>4</td>\n",
       "      <td>10416.666667</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>409</th>\n",
       "      <td>Sultan Palaya</td>\n",
       "      <td>2 Bedroom</td>\n",
       "      <td>550.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>62.00</td>\n",
       "      <td>2</td>\n",
       "      <td>11272.727273</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>425</th>\n",
       "      <td>Chandapura</td>\n",
       "      <td>6 Bedroom</td>\n",
       "      <td>1533.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>85.00</td>\n",
       "      <td>6</td>\n",
       "      <td>5544.683627</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>453</th>\n",
       "      <td>Thippasandra</td>\n",
       "      <td>4 Bedroom</td>\n",
       "      <td>1200.0</td>\n",
       "      <td>4.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>200.00</td>\n",
       "      <td>4</td>\n",
       "      <td>16666.666667</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>472</th>\n",
       "      <td>ITI Employees Layout</td>\n",
       "      <td>4 BHK</td>\n",
       "      <td>1200.0</td>\n",
       "      <td>4.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>230.00</td>\n",
       "      <td>4</td>\n",
       "      <td>19166.666667</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>481</th>\n",
       "      <td>Basavangudi</td>\n",
       "      <td>4 Bedroom</td>\n",
       "      <td>1125.0</td>\n",
       "      <td>4.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>180.00</td>\n",
       "      <td>4</td>\n",
       "      <td>16000.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12973</th>\n",
       "      <td>SMV layout</td>\n",
       "      <td>3 Bedroom</td>\n",
       "      <td>600.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>86.00</td>\n",
       "      <td>3</td>\n",
       "      <td>14333.333333</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12988</th>\n",
       "      <td>Electronic City Phase II</td>\n",
       "      <td>2 BHK</td>\n",
       "      <td>545.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>28.00</td>\n",
       "      <td>2</td>\n",
       "      <td>5137.614679</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12992</th>\n",
       "      <td>BTM 1st Stage</td>\n",
       "      <td>5 Bedroom</td>\n",
       "      <td>1200.0</td>\n",
       "      <td>4.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>200.00</td>\n",
       "      <td>5</td>\n",
       "      <td>16666.666667</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12993</th>\n",
       "      <td>Judicial Layout</td>\n",
       "      <td>5 BHK</td>\n",
       "      <td>1100.0</td>\n",
       "      <td>4.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>199.00</td>\n",
       "      <td>5</td>\n",
       "      <td>18090.909091</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12998</th>\n",
       "      <td>Anekal</td>\n",
       "      <td>2 BHK</td>\n",
       "      <td>625.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>25.00</td>\n",
       "      <td>2</td>\n",
       "      <td>4000.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13023</th>\n",
       "      <td>Hegde Nagar</td>\n",
       "      <td>6 Bedroom</td>\n",
       "      <td>760.0</td>\n",
       "      <td>6.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>98.00</td>\n",
       "      <td>6</td>\n",
       "      <td>12894.736842</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13036</th>\n",
       "      <td>2nd Stage Nagarbhavi</td>\n",
       "      <td>5 Bedroom</td>\n",
       "      <td>1200.0</td>\n",
       "      <td>4.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>240.00</td>\n",
       "      <td>5</td>\n",
       "      <td>20000.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13045</th>\n",
       "      <td>Vasanthpura</td>\n",
       "      <td>6 Bedroom</td>\n",
       "      <td>600.0</td>\n",
       "      <td>6.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>65.00</td>\n",
       "      <td>6</td>\n",
       "      <td>10833.333333</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13052</th>\n",
       "      <td>8th Phase JP Nagar</td>\n",
       "      <td>4 Bedroom</td>\n",
       "      <td>600.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>99.00</td>\n",
       "      <td>4</td>\n",
       "      <td>16500.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13061</th>\n",
       "      <td>CV Raman Nagar</td>\n",
       "      <td>5 Bedroom</td>\n",
       "      <td>1200.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>100.00</td>\n",
       "      <td>5</td>\n",
       "      <td>8333.333333</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13063</th>\n",
       "      <td>Vidyaranyapura</td>\n",
       "      <td>4 Bedroom</td>\n",
       "      <td>770.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>65.25</td>\n",
       "      <td>4</td>\n",
       "      <td>8474.025974</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13073</th>\n",
       "      <td>Nagarbhavi</td>\n",
       "      <td>4 Bedroom</td>\n",
       "      <td>600.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>100.00</td>\n",
       "      <td>4</td>\n",
       "      <td>16666.666667</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13076</th>\n",
       "      <td>Shivaji Nagar</td>\n",
       "      <td>2 BHK</td>\n",
       "      <td>500.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>20.00</td>\n",
       "      <td>2</td>\n",
       "      <td>4000.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13112</th>\n",
       "      <td>Nagavara</td>\n",
       "      <td>3 Bedroom</td>\n",
       "      <td>440.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>35.00</td>\n",
       "      <td>3</td>\n",
       "      <td>7954.545455</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13126</th>\n",
       "      <td>Akshaya Nagar</td>\n",
       "      <td>4 Bedroom</td>\n",
       "      <td>1200.0</td>\n",
       "      <td>4.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>125.00</td>\n",
       "      <td>4</td>\n",
       "      <td>10416.666667</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13146</th>\n",
       "      <td>Basavanapura</td>\n",
       "      <td>7 BHK</td>\n",
       "      <td>1800.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>65.00</td>\n",
       "      <td>7</td>\n",
       "      <td>3611.111111</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13170</th>\n",
       "      <td>Prasanna layout Herohalli</td>\n",
       "      <td>6 Bedroom</td>\n",
       "      <td>1800.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>140.00</td>\n",
       "      <td>6</td>\n",
       "      <td>7777.777778</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13183</th>\n",
       "      <td>Shivaji Nagar</td>\n",
       "      <td>2 BHK</td>\n",
       "      <td>600.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>65.00</td>\n",
       "      <td>2</td>\n",
       "      <td>10833.333333</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13190</th>\n",
       "      <td>Yelahanka</td>\n",
       "      <td>5 Bedroom</td>\n",
       "      <td>1330.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>210.00</td>\n",
       "      <td>5</td>\n",
       "      <td>15789.473684</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13198</th>\n",
       "      <td>Pattegarhpalya</td>\n",
       "      <td>8 Bedroom</td>\n",
       "      <td>1200.0</td>\n",
       "      <td>8.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>140.00</td>\n",
       "      <td>8</td>\n",
       "      <td>11666.666667</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13216</th>\n",
       "      <td>Tilak Nagar</td>\n",
       "      <td>1 BHK</td>\n",
       "      <td>250.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>40.00</td>\n",
       "      <td>1</td>\n",
       "      <td>16000.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13217</th>\n",
       "      <td>T Dasarahalli</td>\n",
       "      <td>6 Bedroom</td>\n",
       "      <td>1200.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>125.00</td>\n",
       "      <td>6</td>\n",
       "      <td>10416.666667</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13219</th>\n",
       "      <td>Laggere</td>\n",
       "      <td>7 Bedroom</td>\n",
       "      <td>1590.0</td>\n",
       "      <td>9.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>132.00</td>\n",
       "      <td>7</td>\n",
       "      <td>8301.886792</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13221</th>\n",
       "      <td>T Dasarahalli</td>\n",
       "      <td>9 Bedroom</td>\n",
       "      <td>1178.0</td>\n",
       "      <td>9.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>75.00</td>\n",
       "      <td>9</td>\n",
       "      <td>6366.723260</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13277</th>\n",
       "      <td>Kundalahalli Colony</td>\n",
       "      <td>7 Bedroom</td>\n",
       "      <td>1400.0</td>\n",
       "      <td>7.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>218.00</td>\n",
       "      <td>7</td>\n",
       "      <td>15571.428571</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13279</th>\n",
       "      <td>Vishwanatha Nagenahalli</td>\n",
       "      <td>6 Bedroom</td>\n",
       "      <td>1200.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>130.00</td>\n",
       "      <td>6</td>\n",
       "      <td>10833.333333</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13281</th>\n",
       "      <td>Margondanahalli</td>\n",
       "      <td>5 Bedroom</td>\n",
       "      <td>1375.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>125.00</td>\n",
       "      <td>5</td>\n",
       "      <td>9090.909091</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13300</th>\n",
       "      <td>Hosakerehalli</td>\n",
       "      <td>5 Bedroom</td>\n",
       "      <td>1500.0</td>\n",
       "      <td>6.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>145.00</td>\n",
       "      <td>5</td>\n",
       "      <td>9666.666667</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13303</th>\n",
       "      <td>Vidyaranyapura</td>\n",
       "      <td>5 Bedroom</td>\n",
       "      <td>774.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>70.00</td>\n",
       "      <td>5</td>\n",
       "      <td>9043.927649</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13311</th>\n",
       "      <td>Ramamurthy Nagar</td>\n",
       "      <td>7 Bedroom</td>\n",
       "      <td>1500.0</td>\n",
       "      <td>9.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>250.00</td>\n",
       "      <td>7</td>\n",
       "      <td>16666.666667</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>911 rows × 8 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                                       location       size  total_sqft  bath  \\\n",
       "26                              Electronic City      2 BHK       660.0   1.0   \n",
       "58                                Murugeshpalya  6 Bedroom      1407.0   4.0   \n",
       "68                          Devarachikkanahalli  8 Bedroom      1350.0   7.0   \n",
       "70                                  Double Road  3 Bedroom       500.0   3.0   \n",
       "78                             Kaval Byrasandra      2 BHK       460.0   1.0   \n",
       "93                                  ISRO Layout  4 Bedroom      1200.0   4.0   \n",
       "101                                  Chandapura      2 BHK       650.0   1.0   \n",
       "119                                 Hennur Road  2 Bedroom       276.0   3.0   \n",
       "129                          Vishwapriya Layout  7 Bedroom       950.0   7.0   \n",
       "133    Ramaswamy Palya - Kammanahalli Main Road  4 Bedroom      1200.0   4.0   \n",
       "149                                      Dinnur  6 Bedroom      1034.0   5.0   \n",
       "170                        Kothnur Narayanapura      6 BHK      1300.0   6.0   \n",
       "176                          Kumaraswami Layout  5 Bedroom       600.0   3.0   \n",
       "193                                     Ejipura  7 Bedroom      1800.0   7.0   \n",
       "201                               Langford Town      3 BHK       912.0   2.0   \n",
       "241                              Mukkutam Nagar  8 Bedroom      2600.0   8.0   \n",
       "255                              Horamavu Agara  4 Bedroom      1200.0   2.0   \n",
       "258                              MCECHS  layout  5 Bedroom      1200.0   5.0   \n",
       "282                                  Srirampura  6 Bedroom      1450.0   6.0   \n",
       "299                                  Giri Nagar  3 Bedroom       880.0   3.0   \n",
       "315                                  Srirampura  5 Bedroom      1200.0   5.0   \n",
       "323                                Akshaya Vana  4 Bedroom      1200.0   4.0   \n",
       "397                               K N Extension      6 BHK       700.0   3.0   \n",
       "403                            Gokula Extension      4 BHK      1200.0   4.0   \n",
       "406                           Bannerghatta Road  4 Bedroom      1200.0   2.0   \n",
       "409                               Sultan Palaya  2 Bedroom       550.0   1.0   \n",
       "425                                  Chandapura  6 Bedroom      1533.0   5.0   \n",
       "453                                Thippasandra  4 Bedroom      1200.0   4.0   \n",
       "472                        ITI Employees Layout      4 BHK      1200.0   4.0   \n",
       "481                                 Basavangudi  4 Bedroom      1125.0   4.0   \n",
       "...                                         ...        ...         ...   ...   \n",
       "12973                                SMV layout  3 Bedroom       600.0   3.0   \n",
       "12988                  Electronic City Phase II      2 BHK       545.0   1.0   \n",
       "12992                             BTM 1st Stage  5 Bedroom      1200.0   4.0   \n",
       "12993                           Judicial Layout      5 BHK      1100.0   4.0   \n",
       "12998                                    Anekal      2 BHK       625.0   1.0   \n",
       "13023                               Hegde Nagar  6 Bedroom       760.0   6.0   \n",
       "13036                      2nd Stage Nagarbhavi  5 Bedroom      1200.0   4.0   \n",
       "13045                               Vasanthpura  6 Bedroom       600.0   6.0   \n",
       "13052                        8th Phase JP Nagar  4 Bedroom       600.0   5.0   \n",
       "13061                            CV Raman Nagar  5 Bedroom      1200.0   2.0   \n",
       "13063                            Vidyaranyapura  4 Bedroom       770.0   3.0   \n",
       "13073                                Nagarbhavi  4 Bedroom       600.0   3.0   \n",
       "13076                             Shivaji Nagar      2 BHK       500.0   1.0   \n",
       "13112                                  Nagavara  3 Bedroom       440.0   3.0   \n",
       "13126                             Akshaya Nagar  4 Bedroom      1200.0   4.0   \n",
       "13146                              Basavanapura      7 BHK      1800.0   5.0   \n",
       "13170                 Prasanna layout Herohalli  6 Bedroom      1800.0   5.0   \n",
       "13183                             Shivaji Nagar      2 BHK       600.0   1.0   \n",
       "13190                                 Yelahanka  5 Bedroom      1330.0   5.0   \n",
       "13198                            Pattegarhpalya  8 Bedroom      1200.0   8.0   \n",
       "13216                               Tilak Nagar      1 BHK       250.0   2.0   \n",
       "13217                             T Dasarahalli  6 Bedroom      1200.0   3.0   \n",
       "13219                                   Laggere  7 Bedroom      1590.0   9.0   \n",
       "13221                             T Dasarahalli  9 Bedroom      1178.0   9.0   \n",
       "13277                       Kundalahalli Colony  7 Bedroom      1400.0   7.0   \n",
       "13279                   Vishwanatha Nagenahalli  6 Bedroom      1200.0   5.0   \n",
       "13281                           Margondanahalli  5 Bedroom      1375.0   5.0   \n",
       "13300                             Hosakerehalli  5 Bedroom      1500.0   6.0   \n",
       "13303                            Vidyaranyapura  5 Bedroom       774.0   5.0   \n",
       "13311                          Ramamurthy Nagar  7 Bedroom      1500.0   9.0   \n",
       "\n",
       "       balcony   price  bhk  price_per_sqft  \n",
       "26         1.0   23.10    2     3500.000000  \n",
       "58         1.0  150.00    6    10660.980810  \n",
       "68         0.0   85.00    8     6296.296296  \n",
       "70         2.0  100.00    3    20000.000000  \n",
       "78         0.0   22.00    2     4782.608696  \n",
       "93         2.0  155.00    4    12916.666667  \n",
       "101        1.0   17.00    2     2615.384615  \n",
       "119        3.0   23.00    2     8333.333333  \n",
       "129        0.0  115.00    7    12105.263158  \n",
       "133        0.0  210.00    4    17500.000000  \n",
       "149        NaN  185.00    6    17891.682785  \n",
       "170        0.0   99.00    6     7615.384615  \n",
       "176        2.0   85.00    5    14166.666667  \n",
       "193        1.0  250.00    7    13888.888889  \n",
       "201        1.0   70.00    3     7675.438596  \n",
       "241        2.0  180.00    8     6923.076923  \n",
       "255        0.0   95.00    4     7916.666667  \n",
       "258        NaN  170.00    5    14166.666667  \n",
       "282        0.0  250.00    6    17241.379310  \n",
       "299        1.0  140.00    3    15909.090909  \n",
       "315        2.0  180.00    5    15000.000000  \n",
       "323        3.0  165.00    4    13750.000000  \n",
       "397        NaN  120.00    6    17142.857143  \n",
       "403        1.0  175.00    4    14583.333333  \n",
       "406        0.0  125.00    4    10416.666667  \n",
       "409        1.0   62.00    2    11272.727273  \n",
       "425        3.0   85.00    6     5544.683627  \n",
       "453        2.0  200.00    4    16666.666667  \n",
       "472        1.0  230.00    4    19166.666667  \n",
       "481        3.0  180.00    4    16000.000000  \n",
       "...        ...     ...  ...             ...  \n",
       "12973      3.0   86.00    3    14333.333333  \n",
       "12988      1.0   28.00    2     5137.614679  \n",
       "12992      2.0  200.00    5    16666.666667  \n",
       "12993      3.0  199.00    5    18090.909091  \n",
       "12998      1.0   25.00    2     4000.000000  \n",
       "13023      0.0   98.00    6    12894.736842  \n",
       "13036      2.0  240.00    5    20000.000000  \n",
       "13045      2.0   65.00    6    10833.333333  \n",
       "13052      2.0   99.00    4    16500.000000  \n",
       "13061      1.0  100.00    5     8333.333333  \n",
       "13063      2.0   65.25    4     8474.025974  \n",
       "13073      2.0  100.00    4    16666.666667  \n",
       "13076      1.0   20.00    2     4000.000000  \n",
       "13112      1.0   35.00    3     7954.545455  \n",
       "13126      2.0  125.00    4    10416.666667  \n",
       "13146      3.0   65.00    7     3611.111111  \n",
       "13170      1.0  140.00    6     7777.777778  \n",
       "13183      1.0   65.00    2    10833.333333  \n",
       "13190      0.0  210.00    5    15789.473684  \n",
       "13198      0.0  140.00    8    11666.666667  \n",
       "13216      2.0   40.00    1    16000.000000  \n",
       "13217      NaN  125.00    6    10416.666667  \n",
       "13219      3.0  132.00    7     8301.886792  \n",
       "13221      1.0   75.00    9     6366.723260  \n",
       "13277      NaN  218.00    7    15571.428571  \n",
       "13279      NaN  130.00    6    10833.333333  \n",
       "13281      1.0  125.00    5     9090.909091  \n",
       "13300      2.0  145.00    5     9666.666667  \n",
       "13303      3.0   70.00    5     9043.927649  \n",
       "13311      2.0  250.00    7    16666.666667  \n",
       "\n",
       "[911 rows x 8 columns]"
      ]
     },
     "execution_count": 31,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df6[(df6.total_sqft/df6.bhk)<(1000/3)]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "metadata": {},
   "outputs": [],
   "source": [
    "df7 = df6[~((df6.total_sqft/df6.bhk)<(1000/3))]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(12080, 8)"
      ]
     },
     "execution_count": 33,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df7.shape"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<h2 style=\"color:purple\">Location is a categorical variable. We need to do some dimensionality reduction here</h2>"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "location\n",
       " Anekal                                             1\n",
       " Banaswadi                                          1\n",
       " Basavangudi                                        1\n",
       " Devarabeesana Halli                                6\n",
       " Devarachikkanahalli                               14\n",
       " Electronic City                                    2\n",
       " Mysore Highway                                     4\n",
       " Rachenahalli                                       2\n",
       " Sector 1 HSR Layout                                1\n",
       " Thanisandra                                        3\n",
       " Whitefield                                         1\n",
       " south                                              2\n",
       "1 Giri Nagar                                        1\n",
       "1 Immadihalli                                       1\n",
       "12th cross srinivas nagar banshankari 3rd stage     1\n",
       "1Hoysalanagar                                       1\n",
       "1st Block BEL Layout                                2\n",
       "1st Block HBR Layout                                3\n",
       "1st Block HRBR Layout                               3\n",
       "1st Block Jayanagar                                10\n",
       "1st Block Koramangala                               7\n",
       "1st Phase JP Nagar                                 20\n",
       "1st Stage Domlur                                    1\n",
       "1st Stage Indira Nagar                              4\n",
       "2nd Block Bel Layout                                2\n",
       "2nd Block Hrbr Layout                               4\n",
       "2nd Block Jayanagar                                 2\n",
       "2nd Block Koramangala                               2\n",
       "2nd Phase JP Nagar                                  7\n",
       "2nd Phase Judicial Layout                          11\n",
       "                                                   ..\n",
       "Yeshwanthpur                                       79\n",
       "Yeshwanthpur Industrial Suburb                      3\n",
       "Zuzuvadi                                            1\n",
       "adigondanhalli                                      1\n",
       "anjananager magdi road                              1\n",
       "asha township, off hennur road                      1\n",
       "banashankari stage iii sa                           1\n",
       "basaveshwarnagar                                    1\n",
       "beml layout, basaveshwara nagar                     1\n",
       "cooketown                                           2\n",
       "elachenahalli                                       1\n",
       "frazertown                                          2\n",
       "kadubisnahalli                                      1\n",
       "kanakapura main road                                1\n",
       "kanakapura road                                     1\n",
       "manyata                                             1\n",
       "manyata park                                        2\n",
       "manyata tech park                                   1\n",
       "mvj engineering college                             1\n",
       "near Ramanashree California resort                  1\n",
       "pavitra paradise                                    1\n",
       "poornaprajna layout                                 1\n",
       "ravindra nagar, T.dasarahalli peenya                1\n",
       "rr nagar                                            1\n",
       "sankeswari                                          1\n",
       "sapthagiri Layout                                   1\n",
       "sarjapura main road                                 1\n",
       "tc.palya                                            4\n",
       "white field,kadugodi                                1\n",
       "whitefiled                                          1\n",
       "Name: location, Length: 1159, dtype: int64"
      ]
     },
     "execution_count": 34,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df7.groupby('location')['location'].agg('count')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "count    12080.000000\n",
       "mean      5960.757704\n",
       "std       2783.980286\n",
       "min       2000.000000\n",
       "25%       4200.000000\n",
       "50%       5246.407610\n",
       "75%       6750.000000\n",
       "max      20000.000000\n",
       "Name: price_per_sqft, dtype: float64"
      ]
     },
     "execution_count": 35,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df7.price_per_sqft.describe()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "metadata": {},
   "outputs": [],
   "source": [
    "def get_tier(p):\n",
    "    if p<=5000:\n",
    "        return 'tier1'\n",
    "    if p>5000 and p<=8000:\n",
    "        return 'tier2'\n",
    "    if p>8000 and p<=11000:\n",
    "        return 'tier3'\n",
    "    if p>11000 and p<=14000:\n",
    "        return 'tier4'\n",
    "    if p>14000 and p<=17000:\n",
    "        return 'tier5'    \n",
    "    if p>17000:\n",
    "        return 'tier6'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "metadata": {},
   "outputs": [],
   "source": [
    "loc_tier = {}\n",
    "for index, row in df7.iterrows():\n",
    "    if row.location not in loc_tier:\n",
    "        loc_tier[row.location] = {\n",
    "            'tier1': 0,\n",
    "            'tier2': 0,\n",
    "            'tier3': 0,\n",
    "            'tier4': 0,\n",
    "            'tier5': 0,\n",
    "            'tier6': 0\n",
    "        }\n",
    "    tier = get_tier(row.price_per_sqft)\n",
    "    loc_tier[row.location][tier] += 1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "metadata": {},
   "outputs": [],
   "source": [
    "records = []\n",
    "for loc, tiers in loc_tier.items():\n",
    "    records.append({\n",
    "        'location': loc,\n",
    "        'tier1': tiers['tier1'],\n",
    "        'tier2': tiers['tier2'],\n",
    "        'tier3': tiers['tier3'],\n",
    "        'tier4': tiers['tier4'],\n",
    "        'tier5': tiers['tier5'],\n",
    "        'tier6': tiers['tier6'],\n",
    "    })"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>tier1</th>\n",
       "      <th>tier2</th>\n",
       "      <th>tier3</th>\n",
       "      <th>tier4</th>\n",
       "      <th>tier5</th>\n",
       "      <th>tier6</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>location</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>Electronic City Phase II</th>\n",
       "      <td>100</td>\n",
       "      <td>23</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Chikka Tirupathi</th>\n",
       "      <td>12</td>\n",
       "      <td>5</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Uttarahalli</th>\n",
       "      <td>157</td>\n",
       "      <td>20</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Lingadheeranahalli</th>\n",
       "      <td>1</td>\n",
       "      <td>21</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Kothanur</th>\n",
       "      <td>39</td>\n",
       "      <td>21</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                          tier1  tier2  tier3  tier4  tier5  tier6\n",
       "location                                                          \n",
       "Electronic City Phase II    100     23      0      0      0      0\n",
       "Chikka Tirupathi             12      5      0      0      0      0\n",
       "Uttarahalli                 157     20      1      0      0      0\n",
       "Lingadheeranahalli            1     21      1      0      0      0\n",
       "Kothanur                     39     21      2      0      1      0"
      ]
     },
     "execution_count": 39,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "tier_df = pd.DataFrame(records)\n",
    "tier_df.set_index('location',inplace=True)\n",
    "tier_df.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 40,
   "metadata": {},
   "outputs": [],
   "source": [
    "def select_tier(row):\n",
    "    return row.idxmax()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "metadata": {},
   "outputs": [],
   "source": [
    "tier_df['tier'] = tier_df.apply(select_tier,axis='columns')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>tier1</th>\n",
       "      <th>tier2</th>\n",
       "      <th>tier3</th>\n",
       "      <th>tier4</th>\n",
       "      <th>tier5</th>\n",
       "      <th>tier6</th>\n",
       "      <th>tier</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>location</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>Electronic City Phase II</th>\n",
       "      <td>100</td>\n",
       "      <td>23</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>tier1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Chikka Tirupathi</th>\n",
       "      <td>12</td>\n",
       "      <td>5</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>tier1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Uttarahalli</th>\n",
       "      <td>157</td>\n",
       "      <td>20</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>tier1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Lingadheeranahalli</th>\n",
       "      <td>1</td>\n",
       "      <td>21</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>tier2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Kothanur</th>\n",
       "      <td>39</td>\n",
       "      <td>21</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>tier1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Whitefield</th>\n",
       "      <td>196</td>\n",
       "      <td>266</td>\n",
       "      <td>37</td>\n",
       "      <td>23</td>\n",
       "      <td>7</td>\n",
       "      <td>2</td>\n",
       "      <td>tier2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Old Airport Road</th>\n",
       "      <td>1</td>\n",
       "      <td>27</td>\n",
       "      <td>4</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>tier2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Rajaji Nagar</th>\n",
       "      <td>0</td>\n",
       "      <td>7</td>\n",
       "      <td>24</td>\n",
       "      <td>25</td>\n",
       "      <td>28</td>\n",
       "      <td>10</td>\n",
       "      <td>tier5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Marathahalli</th>\n",
       "      <td>61</td>\n",
       "      <td>98</td>\n",
       "      <td>8</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>tier2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7th Phase JP Nagar</th>\n",
       "      <td>47</td>\n",
       "      <td>77</td>\n",
       "      <td>14</td>\n",
       "      <td>4</td>\n",
       "      <td>3</td>\n",
       "      <td>0</td>\n",
       "      <td>tier2</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                          tier1  tier2  tier3  tier4  tier5  tier6   tier\n",
       "location                                                                 \n",
       "Electronic City Phase II    100     23      0      0      0      0  tier1\n",
       "Chikka Tirupathi             12      5      0      0      0      0  tier1\n",
       "Uttarahalli                 157     20      1      0      0      0  tier1\n",
       "Lingadheeranahalli            1     21      1      0      0      0  tier2\n",
       "Kothanur                     39     21      2      0      1      0  tier1\n",
       "Whitefield                  196    266     37     23      7      2  tier2\n",
       "Old Airport Road              1     27      4      0      0      0  tier2\n",
       "Rajaji Nagar                  0      7     24     25     28     10  tier5\n",
       "Marathahalli                 61     98      8      2      1      0  tier2\n",
       "7th Phase JP Nagar           47     77     14      4      3      0  tier2"
      ]
     },
     "execution_count": 42,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "tier_df.head(10)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 43,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>tier1</th>\n",
       "      <th>tier2</th>\n",
       "      <th>tier3</th>\n",
       "      <th>tier4</th>\n",
       "      <th>tier5</th>\n",
       "      <th>tier6</th>\n",
       "      <th>tier</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>location</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>RMV</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>tier6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Sadashiva Nagar</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>6</td>\n",
       "      <td>tier6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Ramamohanapuram</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>tier6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Cunningham Road</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>7</td>\n",
       "      <td>tier6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2nd Block Koramangala</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>tier6</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                       tier1  tier2  tier3  tier4  tier5  tier6   tier\n",
       "location                                                              \n",
       "RMV                        0      0      1      0      0      2  tier6\n",
       "Sadashiva Nagar            0      0      0      1      1      6  tier6\n",
       "Ramamohanapuram            0      0      0      0      0      1  tier6\n",
       "Cunningham Road            0      0      0      1      0      7  tier6\n",
       "2nd Block Koramangala      0      0      0      0      0      2  tier6"
      ]
     },
     "execution_count": 43,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "tier_df[tier_df.tier=='tier6'].head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 44,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>tier1</th>\n",
       "      <th>tier2</th>\n",
       "      <th>tier3</th>\n",
       "      <th>tier4</th>\n",
       "      <th>tier5</th>\n",
       "      <th>tier6</th>\n",
       "      <th>tier</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>location</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>Rajaji Nagar</th>\n",
       "      <td>0</td>\n",
       "      <td>7</td>\n",
       "      <td>24</td>\n",
       "      <td>25</td>\n",
       "      <td>28</td>\n",
       "      <td>10</td>\n",
       "      <td>tier5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Giri Nagar</th>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>3</td>\n",
       "      <td>2</td>\n",
       "      <td>tier5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Binny Mills Employees Colony</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>tier5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2nd Stage Nagarbhavi</th>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>4</td>\n",
       "      <td>1</td>\n",
       "      <td>tier5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7th Block Jayanagar</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>tier5</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                              tier1  tier2  tier3  tier4  tier5  tier6   tier\n",
       "location                                                                     \n",
       "Rajaji Nagar                      0      7     24     25     28     10  tier5\n",
       "Giri Nagar                        0      1      0      2      3      2  tier5\n",
       "Binny Mills Employees Colony      0      0      0      0      1      0  tier5\n",
       "2nd Stage Nagarbhavi              0      2      0      0      4      1  tier5\n",
       "7th Block Jayanagar               0      0      1      0      2      2  tier5"
      ]
     },
     "execution_count": 44,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "tier_df[tier_df.tier=='tier5'].head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 45,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(1159, 7)"
      ]
     },
     "execution_count": 45,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "tier_df.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 46,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "tier\n",
       "tier1    582\n",
       "tier2    393\n",
       "tier3     96\n",
       "tier4     47\n",
       "tier5     27\n",
       "tier6     14\n",
       "Name: tier, dtype: int64"
      ]
     },
     "execution_count": 46,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "stats = tier_df.groupby('tier')['tier'].agg('count')\n",
    "stats"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 47,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([582, 393,  96,  47,  27,  14], dtype=int64)"
      ]
     },
     "execution_count": 47,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "stats.values"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 48,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<BarContainer object of 6 artists>"
      ]
     },
     "execution_count": 48,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXoAAAD8CAYAAAB5Pm/hAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4zLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvnQurowAAEKhJREFUeJzt3X2s5FV9x/H3RxbEorgqF7LdXXtp3VqNqUhvCA2JoWIsD8bdP6TRtLKl22zTUoKxTbuaNsakf2CaSDVpSAhYlxYfECVskGjJKrE2Bbw8yIOLYYuUvVlkr/KgSCxBv/1jztbLcpc7987cvcvZ9yuZzO93fmdmvicz9zNnz/xmNlWFJKlfL1vpAiRJy8ugl6TOGfSS1DmDXpI6Z9BLUucMeknqnEEvSZ0z6CWpcwa9JHVu1UoXAHDCCSfU5OTkSpchSS8pd9xxxw+ramKhfkMFfZLVwJXAW4AC/gT4HvAFYBJ4GPiDqnoiSYBPAucCzwB/XFV3vtj9T05OMj09PUwpkqQmyf8M02/YpZtPAl+tqt8C3grsArYBO6tqA7Cz7QOcA2xol63A5YuoW5I0ZgsGfZLjgbcDVwFU1bNV9SSwEdjeum0HNrXtjcDVNXArsDrJmrFXLkkayjAz+l8HZoF/SXJXkiuTHAecVFWPArTrE1v/tcCeObefaW3Pk2Rrkukk07OzsyMNQpJ0cMME/SrgVODyqnob8FN+uUwzn8zT9oLfQq6qK6pqqqqmJiYW/CxBkrREwwT9DDBTVbe1/esYBP9j+5dk2vW+Of3Xz7n9OmDveMqVJC3WgkFfVT8A9iR5Y2s6C/gusAPY3No2Aze07R3ABRk4HXhq/xKPJOnQG/Y8+ouBa5IcAzwEXMjgTeLaJFuAR4DzW9+bGJxauZvB6ZUXjrViSdKiDBX0VXU3MDXPobPm6VvARSPWJUkaE38CQZI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DG4Bngdur6vsrVtnSLGo8SV4JfAn4YFX9+JBWOryhx1SD5Y5TkqwGrk/ylqpa8c9UDjDUeJK8G9hXVXckOXNFKh3eYl53Z1TV3iQnAjcneaAG/1o+nAw7nlXAqcDFVXVbkk8C24C/P9QFvxiDHsLgSfra8xoHf1g/XZGKRjP0eNo69peAa6rqy4eswsVb9HNUVU8muQU4Gzjcgn7Y8ZwBvCfJucCxwPFJ/q2q/uiQVTq8oZ+jqtrbrvcluZ7BL94ebkE/7HhmgJmquq3tX8cg6A8rR9Ia/U+AV83T/jXgz1vokeQ3kxx3SCtbmpHGkyQM1hV3VdUnlrXS4Y06pok2kyfJK4B3Ag8sY70LGWk8VfXhqlpXVZMMfkrk64dByI/6HB3XPvynHX8XK/tGPOpz9ANgT5I3tqazgBU7oeFgjpgZfVX9KMl/tg9bds05dCWDtbk7W/jNApvmu48kn2OwRndCkhngo1V11bIWfhBjGM8ZwAcYfKB0d2v7SA2+1bwixjCmNcD2DM7AeRlwbVWt2CmJ43jNHW7GMKaTGCypwSB/PltVX13eqg9uTM/RxcA1GZxx8xBw4TKWvCRHzOmVknSkOpKWbiTpiGTQS1LnDHpJ6pxBL0mdM+glqXMGvSR1zqCXpM4Z9JLUuf8D7o9VKJlqdDAAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.bar(stats.index, stats.values)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 49,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>location</th>\n",
       "      <th>size</th>\n",
       "      <th>total_sqft</th>\n",
       "      <th>bath</th>\n",
       "      <th>balcony</th>\n",
       "      <th>price</th>\n",
       "      <th>bhk</th>\n",
       "      <th>price_per_sqft</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>Electronic City Phase II</td>\n",
       "      <td>2 BHK</td>\n",
       "      <td>1056.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>39.07</td>\n",
       "      <td>2</td>\n",
       "      <td>3699.810606</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>Chikka Tirupathi</td>\n",
       "      <td>4 Bedroom</td>\n",
       "      <td>2600.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>120.00</td>\n",
       "      <td>4</td>\n",
       "      <td>4615.384615</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                   location       size  total_sqft  bath  balcony   price  \\\n",
       "0  Electronic City Phase II      2 BHK      1056.0   2.0      1.0   39.07   \n",
       "1          Chikka Tirupathi  4 Bedroom      2600.0   5.0      3.0  120.00   \n",
       "\n",
       "   bhk  price_per_sqft  \n",
       "0    2     3699.810606  \n",
       "1    4     4615.384615  "
      ]
     },
     "execution_count": 49,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df7.head(2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 50,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\ProgramData\\Anaconda3\\lib\\site-packages\\ipykernel_launcher.py:1: SettingWithCopyWarning: \n",
      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
      "Try using .loc[row_indexer,col_indexer] = value instead\n",
      "\n",
      "See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy\n",
      "  \"\"\"Entry point for launching an IPython kernel.\n"
     ]
    }
   ],
   "source": [
    "df7['tier'] = df7.location.apply(lambda x: tier_df.loc[x]['tier'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 51,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>location</th>\n",
       "      <th>size</th>\n",
       "      <th>total_sqft</th>\n",
       "      <th>bath</th>\n",
       "      <th>balcony</th>\n",
       "      <th>price</th>\n",
       "      <th>bhk</th>\n",
       "      <th>price_per_sqft</th>\n",
       "      <th>tier</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>Electronic City Phase II</td>\n",
       "      <td>2 BHK</td>\n",
       "      <td>1056.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>39.07</td>\n",
       "      <td>2</td>\n",
       "      <td>3699.810606</td>\n",
       "      <td>tier1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>Chikka Tirupathi</td>\n",
       "      <td>4 Bedroom</td>\n",
       "      <td>2600.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>120.00</td>\n",
       "      <td>4</td>\n",
       "      <td>4615.384615</td>\n",
       "      <td>tier1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>Uttarahalli</td>\n",
       "      <td>3 BHK</td>\n",
       "      <td>1440.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>62.00</td>\n",
       "      <td>3</td>\n",
       "      <td>4305.555556</td>\n",
       "      <td>tier1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>Lingadheeranahalli</td>\n",
       "      <td>3 BHK</td>\n",
       "      <td>1521.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>95.00</td>\n",
       "      <td>3</td>\n",
       "      <td>6245.890861</td>\n",
       "      <td>tier2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>Kothanur</td>\n",
       "      <td>2 BHK</td>\n",
       "      <td>1200.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>51.00</td>\n",
       "      <td>2</td>\n",
       "      <td>4250.000000</td>\n",
       "      <td>tier1</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                   location       size  total_sqft  bath  balcony   price  \\\n",
       "0  Electronic City Phase II      2 BHK      1056.0   2.0      1.0   39.07   \n",
       "1          Chikka Tirupathi  4 Bedroom      2600.0   5.0      3.0  120.00   \n",
       "2               Uttarahalli      3 BHK      1440.0   2.0      3.0   62.00   \n",
       "3        Lingadheeranahalli      3 BHK      1521.0   3.0      1.0   95.00   \n",
       "4                  Kothanur      2 BHK      1200.0   2.0      1.0   51.00   \n",
       "\n",
       "   bhk  price_per_sqft   tier  \n",
       "0    2     3699.810606  tier1  \n",
       "1    4     4615.384615  tier1  \n",
       "2    3     4305.555556  tier1  \n",
       "3    3     6245.890861  tier2  \n",
       "4    2     4250.000000  tier1  "
      ]
     },
     "execution_count": 51,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df7.head()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<h2 style='color:purple'>Handle bathrooms feature</h2>"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 52,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "57"
      ]
     },
     "execution_count": 52,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df7.bath.isnull().sum()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 53,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0"
      ]
     },
     "execution_count": 53,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df8 = df7[df7.bath.notnull()]\n",
    "df8.bath.isnull().sum()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 54,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([ 2.,  5.,  3.,  4.,  1.,  8.,  6.,  7.,  9., 14., 12., 16., 10.,\n",
       "       13.])"
      ]
     },
     "execution_count": 54,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df8.bath.unique()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 55,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.collections.PathCollection at 0x28c7211b5c0>"
      ]
     },
     "execution_count": 55,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXQAAAD8CAYAAABn919SAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4zLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvnQurowAAGXtJREFUeJzt3X+Q3HV9x/HnO5cLbiJ6SXOhcCQGUozVRgheS2haB6E2iIxcIyqM6TDVMVO1VqXGkoGpOkMb9VpLO3R0oqVAYSK/4tW2Y2NGsXSshF64hICQ8kMI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wM0IGvS5W5VJLl18Xd/WfRj73Rl1fpv/j1uhO4IBpvXXNsdLxZLOgDwNNFPx+m+sHQTg5808z2mtnmqO0kd38G8gc2sCxqrzSvrMw3qXEPRLdL21vtT6JTETcUTlNQ/1x+BZh095dK2lMV/Zq+lvy7wY5+XUrmAh34uphZj5ntA46S/w/y8Sr9z445uv/H0Xhb8u8/iwW93Hm9rC7FWe/uZwNvAz5sZm+usm2leWV9vvWOOwvz+SKwCjgLeAb4m6g983Mxs1cCdwEfc/efVNu0TFvW59KRr4u7z7j7WcCp5N9R/3qV/ts6lywW9MPA8qKfTwWOtGksVbn7kej7UeBr5F/sZ6Nfb4m+H402rzSvrMw3qXEfjm6XtreMuz8b/SM8DnyZ/OsC9c/lOfKnMuaXtKfCzHrJF8Bb3X1n1NyRr0u5uXTq61Lg7pPAd8ifQ6/U/+yYo/tfTf6UYGv+/adxIaGZL2A++Qs5p/HLiwRvaPe4yoxzEXBi0e3/Jn/ue5i5F7E+H91+O3MvYt0XtS8BfkD+Atbi6PaSFox/JXMvJCY2buB/om0LF98uavFcTi66/XHy5y4B3sDcC1NPkL8oVfGYA+5g7sWvD6U0ByN/Xvu6kvaOe12qzKUTX5d+oC+6nQP+C7i4Uv/Ah5l7UfT2RufY0HjT/IfWxJN4Efkr448DV7d7PBXGeHr05O8HHiqMk/z5sm8Bj0bfC/+YDPiHaE4HgMGifb2P/EWSx4A/asHYd5D/lXea/DuE9yc5bmAQeDB6zPVEH2Br4Vz+ORrrA8DXSwrJ1dG4DlK0yqPSMRe9zvdFc7wDOCGlefwO+V+1HwD2RV8XdeLrUmUunfi6vBEYi8b8IPAX1foHXhH9/Fh0/+mNzrGRL31SVEQkEFk8hy4iIg1QQRcRCYQKuohIIFTQRUQCoYIuIhIIFXQRkUCooIuIBEIFXUQkEP8PRcRzYusJ7v0AAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.scatter(df8.total_sqft,df8.bath)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 56,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>location</th>\n",
       "      <th>size</th>\n",
       "      <th>total_sqft</th>\n",
       "      <th>bath</th>\n",
       "      <th>balcony</th>\n",
       "      <th>price</th>\n",
       "      <th>bhk</th>\n",
       "      <th>price_per_sqft</th>\n",
       "      <th>tier</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>84</th>\n",
       "      <td>EPIP Zone</td>\n",
       "      <td>3 BHK</td>\n",
       "      <td>1499.00</td>\n",
       "      <td>5.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>102.0</td>\n",
       "      <td>3</td>\n",
       "      <td>6804.536358</td>\n",
       "      <td>tier2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>209</th>\n",
       "      <td>Padmanabhanagar</td>\n",
       "      <td>4 Bedroom</td>\n",
       "      <td>1736.00</td>\n",
       "      <td>6.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>190.0</td>\n",
       "      <td>4</td>\n",
       "      <td>10944.700461</td>\n",
       "      <td>tier2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>439</th>\n",
       "      <td>Kasavanhalli</td>\n",
       "      <td>3 Bedroom</td>\n",
       "      <td>1000.00</td>\n",
       "      <td>4.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>110.0</td>\n",
       "      <td>3</td>\n",
       "      <td>11000.000000</td>\n",
       "      <td>tier2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>504</th>\n",
       "      <td>Shampura</td>\n",
       "      <td>1 BHK</td>\n",
       "      <td>375.00</td>\n",
       "      <td>2.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>26.0</td>\n",
       "      <td>1</td>\n",
       "      <td>6933.333333</td>\n",
       "      <td>tier1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>603</th>\n",
       "      <td>Doddagubbi</td>\n",
       "      <td>3 Bedroom</td>\n",
       "      <td>1125.00</td>\n",
       "      <td>4.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>70.0</td>\n",
       "      <td>3</td>\n",
       "      <td>6222.222222</td>\n",
       "      <td>tier1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1068</th>\n",
       "      <td>2nd Stage Nagarbhavi</td>\n",
       "      <td>6 Bedroom</td>\n",
       "      <td>2400.00</td>\n",
       "      <td>8.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>450.0</td>\n",
       "      <td>6</td>\n",
       "      <td>18750.000000</td>\n",
       "      <td>tier5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1078</th>\n",
       "      <td>BTM 1st Stage</td>\n",
       "      <td>9 Bedroom</td>\n",
       "      <td>3300.00</td>\n",
       "      <td>14.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>500.0</td>\n",
       "      <td>9</td>\n",
       "      <td>15151.515152</td>\n",
       "      <td>tier2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1620</th>\n",
       "      <td>Marsur</td>\n",
       "      <td>3 Bedroom</td>\n",
       "      <td>1000.00</td>\n",
       "      <td>4.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>66.0</td>\n",
       "      <td>3</td>\n",
       "      <td>6600.000000</td>\n",
       "      <td>tier2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1671</th>\n",
       "      <td>Herohalli</td>\n",
       "      <td>5 Bedroom</td>\n",
       "      <td>1800.00</td>\n",
       "      <td>6.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>44.5</td>\n",
       "      <td>5</td>\n",
       "      <td>2472.222222</td>\n",
       "      <td>tier1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1978</th>\n",
       "      <td>BTM 2nd Stage</td>\n",
       "      <td>3 Bedroom</td>\n",
       "      <td>1260.00</td>\n",
       "      <td>5.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>185.0</td>\n",
       "      <td>3</td>\n",
       "      <td>14682.539683</td>\n",
       "      <td>tier2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2001</th>\n",
       "      <td>Ananth Nagar</td>\n",
       "      <td>1 BHK</td>\n",
       "      <td>500.00</td>\n",
       "      <td>2.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>14.0</td>\n",
       "      <td>1</td>\n",
       "      <td>2800.000000</td>\n",
       "      <td>tier1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2036</th>\n",
       "      <td>Basaveshwara Nagar Yelahanka</td>\n",
       "      <td>1 BHK</td>\n",
       "      <td>581.91</td>\n",
       "      <td>2.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>25.0</td>\n",
       "      <td>1</td>\n",
       "      <td>4296.197006</td>\n",
       "      <td>tier1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2560</th>\n",
       "      <td>BCC Layout</td>\n",
       "      <td>4 Bedroom</td>\n",
       "      <td>1500.00</td>\n",
       "      <td>5.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>230.0</td>\n",
       "      <td>4</td>\n",
       "      <td>15333.333333</td>\n",
       "      <td>tier1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2774</th>\n",
       "      <td>7th Phase JP Nagar</td>\n",
       "      <td>4 Bedroom</td>\n",
       "      <td>1500.00</td>\n",
       "      <td>5.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>220.0</td>\n",
       "      <td>4</td>\n",
       "      <td>14666.666667</td>\n",
       "      <td>tier2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2876</th>\n",
       "      <td>Shanthi Layout</td>\n",
       "      <td>3 Bedroom</td>\n",
       "      <td>1272.00</td>\n",
       "      <td>4.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>75.0</td>\n",
       "      <td>3</td>\n",
       "      <td>5896.226415</td>\n",
       "      <td>tier2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2994</th>\n",
       "      <td>Ramamurthy Nagar</td>\n",
       "      <td>3 Bedroom</td>\n",
       "      <td>1330.00</td>\n",
       "      <td>4.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>140.0</td>\n",
       "      <td>3</td>\n",
       "      <td>10526.315789</td>\n",
       "      <td>tier1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3113</th>\n",
       "      <td>Kasavanhalli</td>\n",
       "      <td>3 Bedroom</td>\n",
       "      <td>1000.00</td>\n",
       "      <td>4.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>110.0</td>\n",
       "      <td>3</td>\n",
       "      <td>11000.000000</td>\n",
       "      <td>tier2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3489</th>\n",
       "      <td>Mahalakshmi Layout</td>\n",
       "      <td>4 Bedroom</td>\n",
       "      <td>1575.00</td>\n",
       "      <td>5.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>158.0</td>\n",
       "      <td>4</td>\n",
       "      <td>10031.746032</td>\n",
       "      <td>tier2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3745</th>\n",
       "      <td>Chandra Layout</td>\n",
       "      <td>2 Bedroom</td>\n",
       "      <td>815.00</td>\n",
       "      <td>3.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>160.0</td>\n",
       "      <td>2</td>\n",
       "      <td>19631.901840</td>\n",
       "      <td>tier2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3797</th>\n",
       "      <td>Kenchenhalli</td>\n",
       "      <td>2 Bedroom</td>\n",
       "      <td>675.00</td>\n",
       "      <td>3.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>52.0</td>\n",
       "      <td>2</td>\n",
       "      <td>7703.703704</td>\n",
       "      <td>tier2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4035</th>\n",
       "      <td>SMV layout</td>\n",
       "      <td>3 Bedroom</td>\n",
       "      <td>1200.00</td>\n",
       "      <td>4.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>145.0</td>\n",
       "      <td>3</td>\n",
       "      <td>12083.333333</td>\n",
       "      <td>tier4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5220</th>\n",
       "      <td>Anjanapura</td>\n",
       "      <td>1 Bedroom</td>\n",
       "      <td>600.00</td>\n",
       "      <td>2.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>55.0</td>\n",
       "      <td>1</td>\n",
       "      <td>9166.666667</td>\n",
       "      <td>tier1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6292</th>\n",
       "      <td>AMS Layout</td>\n",
       "      <td>3 Bedroom</td>\n",
       "      <td>1200.00</td>\n",
       "      <td>4.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>80.0</td>\n",
       "      <td>3</td>\n",
       "      <td>6666.666667</td>\n",
       "      <td>tier1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6339</th>\n",
       "      <td>Yelahanka New Town</td>\n",
       "      <td>1 BHK</td>\n",
       "      <td>500.00</td>\n",
       "      <td>2.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>24.0</td>\n",
       "      <td>1</td>\n",
       "      <td>4800.000000</td>\n",
       "      <td>tier1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6662</th>\n",
       "      <td>Mahalakshmi Puram</td>\n",
       "      <td>4 Bedroom</td>\n",
       "      <td>1500.00</td>\n",
       "      <td>5.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>233.0</td>\n",
       "      <td>4</td>\n",
       "      <td>15533.333333</td>\n",
       "      <td>tier2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6717</th>\n",
       "      <td>Austin Town</td>\n",
       "      <td>1 BHK</td>\n",
       "      <td>600.00</td>\n",
       "      <td>2.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>23.0</td>\n",
       "      <td>1</td>\n",
       "      <td>3833.333333</td>\n",
       "      <td>tier1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6981</th>\n",
       "      <td>Amruthahalli</td>\n",
       "      <td>3 Bedroom</td>\n",
       "      <td>1200.00</td>\n",
       "      <td>5.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>200.0</td>\n",
       "      <td>3</td>\n",
       "      <td>16666.666667</td>\n",
       "      <td>tier1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7070</th>\n",
       "      <td>Kengeri</td>\n",
       "      <td>1 BHK</td>\n",
       "      <td>400.00</td>\n",
       "      <td>2.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>25.0</td>\n",
       "      <td>1</td>\n",
       "      <td>6250.000000</td>\n",
       "      <td>tier1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7210</th>\n",
       "      <td>Banaswadi</td>\n",
       "      <td>5 Bedroom</td>\n",
       "      <td>1903.00</td>\n",
       "      <td>6.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>140.0</td>\n",
       "      <td>5</td>\n",
       "      <td>7356.805045</td>\n",
       "      <td>tier1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7371</th>\n",
       "      <td>Brookefield</td>\n",
       "      <td>5 Bedroom</td>\n",
       "      <td>1950.00</td>\n",
       "      <td>6.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>175.0</td>\n",
       "      <td>5</td>\n",
       "      <td>8974.358974</td>\n",
       "      <td>tier2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7458</th>\n",
       "      <td>Immadihalli</td>\n",
       "      <td>2 Bedroom</td>\n",
       "      <td>900.00</td>\n",
       "      <td>3.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>105.0</td>\n",
       "      <td>2</td>\n",
       "      <td>11666.666667</td>\n",
       "      <td>tier1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7482</th>\n",
       "      <td>Alur</td>\n",
       "      <td>1 BHK</td>\n",
       "      <td>470.00</td>\n",
       "      <td>2.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>10.0</td>\n",
       "      <td>1</td>\n",
       "      <td>2127.659574</td>\n",
       "      <td>tier1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7484</th>\n",
       "      <td>Vijay Nagar</td>\n",
       "      <td>6 Bedroom</td>\n",
       "      <td>2300.00</td>\n",
       "      <td>7.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>160.0</td>\n",
       "      <td>6</td>\n",
       "      <td>6956.521739</td>\n",
       "      <td>tier2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7496</th>\n",
       "      <td>Hennur Bande</td>\n",
       "      <td>3 Bedroom</td>\n",
       "      <td>1313.00</td>\n",
       "      <td>4.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>150.0</td>\n",
       "      <td>3</td>\n",
       "      <td>11424.219345</td>\n",
       "      <td>tier2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7703</th>\n",
       "      <td>7th Phase JP Nagar</td>\n",
       "      <td>5 Bedroom</td>\n",
       "      <td>1800.00</td>\n",
       "      <td>6.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>270.0</td>\n",
       "      <td>5</td>\n",
       "      <td>15000.000000</td>\n",
       "      <td>tier2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7730</th>\n",
       "      <td>Varanasi</td>\n",
       "      <td>2 Bedroom</td>\n",
       "      <td>800.00</td>\n",
       "      <td>3.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>59.5</td>\n",
       "      <td>2</td>\n",
       "      <td>7437.500000</td>\n",
       "      <td>tier1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8149</th>\n",
       "      <td>Laggere</td>\n",
       "      <td>1 Bedroom</td>\n",
       "      <td>620.00</td>\n",
       "      <td>2.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>48.0</td>\n",
       "      <td>1</td>\n",
       "      <td>7741.935484</td>\n",
       "      <td>tier1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8491</th>\n",
       "      <td>1st Phase JP Nagar</td>\n",
       "      <td>5 Bedroom</td>\n",
       "      <td>2200.00</td>\n",
       "      <td>7.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>350.0</td>\n",
       "      <td>5</td>\n",
       "      <td>15909.090909</td>\n",
       "      <td>tier3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8533</th>\n",
       "      <td>Kadabagere</td>\n",
       "      <td>1 Bedroom</td>\n",
       "      <td>520.00</td>\n",
       "      <td>2.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>29.0</td>\n",
       "      <td>1</td>\n",
       "      <td>5576.923077</td>\n",
       "      <td>tier1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8597</th>\n",
       "      <td>Nagarbhavi</td>\n",
       "      <td>3 BHK</td>\n",
       "      <td>1200.00</td>\n",
       "      <td>4.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>205.0</td>\n",
       "      <td>3</td>\n",
       "      <td>17083.333333</td>\n",
       "      <td>tier1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8657</th>\n",
       "      <td>A Narayanapura</td>\n",
       "      <td>1 BHK</td>\n",
       "      <td>600.00</td>\n",
       "      <td>2.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>35.0</td>\n",
       "      <td>1</td>\n",
       "      <td>5833.333333</td>\n",
       "      <td>tier2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8714</th>\n",
       "      <td>Bommanahalli</td>\n",
       "      <td>3 BHK</td>\n",
       "      <td>1250.00</td>\n",
       "      <td>4.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>39.0</td>\n",
       "      <td>3</td>\n",
       "      <td>3120.000000</td>\n",
       "      <td>tier1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8723</th>\n",
       "      <td>Hennur Road</td>\n",
       "      <td>4 Bedroom</td>\n",
       "      <td>1650.00</td>\n",
       "      <td>5.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>309.0</td>\n",
       "      <td>4</td>\n",
       "      <td>18727.272727</td>\n",
       "      <td>tier2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8725</th>\n",
       "      <td>Attibele</td>\n",
       "      <td>1 BHK</td>\n",
       "      <td>418.00</td>\n",
       "      <td>2.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>11.5</td>\n",
       "      <td>1</td>\n",
       "      <td>2751.196172</td>\n",
       "      <td>tier1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8810</th>\n",
       "      <td>Ramakrishnappa Layout</td>\n",
       "      <td>1 Bedroom</td>\n",
       "      <td>630.00</td>\n",
       "      <td>2.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>70.0</td>\n",
       "      <td>1</td>\n",
       "      <td>11111.111111</td>\n",
       "      <td>tier4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9110</th>\n",
       "      <td>Ananthapura, T C palaya Main Road</td>\n",
       "      <td>2 Bedroom</td>\n",
       "      <td>680.00</td>\n",
       "      <td>3.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>60.0</td>\n",
       "      <td>2</td>\n",
       "      <td>8823.529412</td>\n",
       "      <td>tier3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9264</th>\n",
       "      <td>Banjara Layout</td>\n",
       "      <td>2 Bedroom</td>\n",
       "      <td>753.00</td>\n",
       "      <td>3.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>59.5</td>\n",
       "      <td>2</td>\n",
       "      <td>7901.726428</td>\n",
       "      <td>tier2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9611</th>\n",
       "      <td>Judicial Layout</td>\n",
       "      <td>3 Bedroom</td>\n",
       "      <td>1200.00</td>\n",
       "      <td>4.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>220.0</td>\n",
       "      <td>3</td>\n",
       "      <td>18333.333333</td>\n",
       "      <td>tier1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10043</th>\n",
       "      <td>Ramchandrapuram</td>\n",
       "      <td>1 Bedroom</td>\n",
       "      <td>400.00</td>\n",
       "      <td>2.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>50.0</td>\n",
       "      <td>1</td>\n",
       "      <td>12500.000000</td>\n",
       "      <td>tier4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10048</th>\n",
       "      <td>Gkvk Layout</td>\n",
       "      <td>3 Bedroom</td>\n",
       "      <td>1200.00</td>\n",
       "      <td>4.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>180.0</td>\n",
       "      <td>3</td>\n",
       "      <td>15000.000000</td>\n",
       "      <td>tier5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10124</th>\n",
       "      <td>Kodigehalli</td>\n",
       "      <td>3 Bedroom</td>\n",
       "      <td>1200.00</td>\n",
       "      <td>4.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>156.0</td>\n",
       "      <td>3</td>\n",
       "      <td>13000.000000</td>\n",
       "      <td>tier1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10245</th>\n",
       "      <td>Bagalakunte</td>\n",
       "      <td>2 Bedroom</td>\n",
       "      <td>1200.00</td>\n",
       "      <td>4.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>138.0</td>\n",
       "      <td>2</td>\n",
       "      <td>11500.000000</td>\n",
       "      <td>tier1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10305</th>\n",
       "      <td>Brookefield</td>\n",
       "      <td>4 Bedroom</td>\n",
       "      <td>1500.00</td>\n",
       "      <td>5.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>160.0</td>\n",
       "      <td>4</td>\n",
       "      <td>10666.666667</td>\n",
       "      <td>tier2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10645</th>\n",
       "      <td>Mylasandra</td>\n",
       "      <td>1 Bedroom</td>\n",
       "      <td>500.00</td>\n",
       "      <td>2.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>80.0</td>\n",
       "      <td>1</td>\n",
       "      <td>16000.000000</td>\n",
       "      <td>tier1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11301</th>\n",
       "      <td>Banashankari Stage V</td>\n",
       "      <td>3 Bedroom</td>\n",
       "      <td>1200.00</td>\n",
       "      <td>4.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>240.0</td>\n",
       "      <td>3</td>\n",
       "      <td>20000.000000</td>\n",
       "      <td>tier1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11894</th>\n",
       "      <td>Sarjapur</td>\n",
       "      <td>3 Bedroom</td>\n",
       "      <td>1500.00</td>\n",
       "      <td>5.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>95.0</td>\n",
       "      <td>3</td>\n",
       "      <td>6333.333333</td>\n",
       "      <td>tier1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12103</th>\n",
       "      <td>Thanisandra</td>\n",
       "      <td>3 BHK</td>\n",
       "      <td>1806.00</td>\n",
       "      <td>6.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>116.0</td>\n",
       "      <td>3</td>\n",
       "      <td>6423.034330</td>\n",
       "      <td>tier2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12303</th>\n",
       "      <td>Kothanur</td>\n",
       "      <td>4 Bedroom</td>\n",
       "      <td>1600.00</td>\n",
       "      <td>5.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>130.0</td>\n",
       "      <td>4</td>\n",
       "      <td>8125.000000</td>\n",
       "      <td>tier1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12413</th>\n",
       "      <td>5th Phase JP Nagar</td>\n",
       "      <td>7 BHK</td>\n",
       "      <td>2500.00</td>\n",
       "      <td>8.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>95.0</td>\n",
       "      <td>7</td>\n",
       "      <td>3800.000000</td>\n",
       "      <td>tier1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12699</th>\n",
       "      <td>Yelahanka</td>\n",
       "      <td>1 BHK</td>\n",
       "      <td>602.00</td>\n",
       "      <td>2.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>30.0</td>\n",
       "      <td>1</td>\n",
       "      <td>4983.388704</td>\n",
       "      <td>tier1</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>61 rows × 9 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                                location       size  total_sqft  bath  \\\n",
       "84                             EPIP Zone      3 BHK     1499.00   5.0   \n",
       "209                      Padmanabhanagar  4 Bedroom     1736.00   6.0   \n",
       "439                         Kasavanhalli  3 Bedroom     1000.00   4.0   \n",
       "504                             Shampura      1 BHK      375.00   2.0   \n",
       "603                           Doddagubbi  3 Bedroom     1125.00   4.0   \n",
       "1068                2nd Stage Nagarbhavi  6 Bedroom     2400.00   8.0   \n",
       "1078                       BTM 1st Stage  9 Bedroom     3300.00  14.0   \n",
       "1620                              Marsur  3 Bedroom     1000.00   4.0   \n",
       "1671                           Herohalli  5 Bedroom     1800.00   6.0   \n",
       "1978                       BTM 2nd Stage  3 Bedroom     1260.00   5.0   \n",
       "2001                        Ananth Nagar      1 BHK      500.00   2.0   \n",
       "2036        Basaveshwara Nagar Yelahanka      1 BHK      581.91   2.0   \n",
       "2560                          BCC Layout  4 Bedroom     1500.00   5.0   \n",
       "2774                  7th Phase JP Nagar  4 Bedroom     1500.00   5.0   \n",
       "2876                      Shanthi Layout  3 Bedroom     1272.00   4.0   \n",
       "2994                    Ramamurthy Nagar  3 Bedroom     1330.00   4.0   \n",
       "3113                        Kasavanhalli  3 Bedroom     1000.00   4.0   \n",
       "3489                  Mahalakshmi Layout  4 Bedroom     1575.00   5.0   \n",
       "3745                      Chandra Layout  2 Bedroom      815.00   3.0   \n",
       "3797                        Kenchenhalli  2 Bedroom      675.00   3.0   \n",
       "4035                          SMV layout  3 Bedroom     1200.00   4.0   \n",
       "5220                          Anjanapura  1 Bedroom      600.00   2.0   \n",
       "6292                          AMS Layout  3 Bedroom     1200.00   4.0   \n",
       "6339                  Yelahanka New Town      1 BHK      500.00   2.0   \n",
       "6662                   Mahalakshmi Puram  4 Bedroom     1500.00   5.0   \n",
       "6717                         Austin Town      1 BHK      600.00   2.0   \n",
       "6981                        Amruthahalli  3 Bedroom     1200.00   5.0   \n",
       "7070                             Kengeri      1 BHK      400.00   2.0   \n",
       "7210                           Banaswadi  5 Bedroom     1903.00   6.0   \n",
       "7371                         Brookefield  5 Bedroom     1950.00   6.0   \n",
       "...                                  ...        ...         ...   ...   \n",
       "7458                         Immadihalli  2 Bedroom      900.00   3.0   \n",
       "7482                                Alur      1 BHK      470.00   2.0   \n",
       "7484                         Vijay Nagar  6 Bedroom     2300.00   7.0   \n",
       "7496                        Hennur Bande  3 Bedroom     1313.00   4.0   \n",
       "7703                  7th Phase JP Nagar  5 Bedroom     1800.00   6.0   \n",
       "7730                            Varanasi  2 Bedroom      800.00   3.0   \n",
       "8149                             Laggere  1 Bedroom      620.00   2.0   \n",
       "8491                  1st Phase JP Nagar  5 Bedroom     2200.00   7.0   \n",
       "8533                          Kadabagere  1 Bedroom      520.00   2.0   \n",
       "8597                          Nagarbhavi      3 BHK     1200.00   4.0   \n",
       "8657                      A Narayanapura      1 BHK      600.00   2.0   \n",
       "8714                        Bommanahalli      3 BHK     1250.00   4.0   \n",
       "8723                         Hennur Road  4 Bedroom     1650.00   5.0   \n",
       "8725                            Attibele      1 BHK      418.00   2.0   \n",
       "8810               Ramakrishnappa Layout  1 Bedroom      630.00   2.0   \n",
       "9110   Ananthapura, T C palaya Main Road  2 Bedroom      680.00   3.0   \n",
       "9264                      Banjara Layout  2 Bedroom      753.00   3.0   \n",
       "9611                     Judicial Layout  3 Bedroom     1200.00   4.0   \n",
       "10043                    Ramchandrapuram  1 Bedroom      400.00   2.0   \n",
       "10048                        Gkvk Layout  3 Bedroom     1200.00   4.0   \n",
       "10124                        Kodigehalli  3 Bedroom     1200.00   4.0   \n",
       "10245                        Bagalakunte  2 Bedroom     1200.00   4.0   \n",
       "10305                        Brookefield  4 Bedroom     1500.00   5.0   \n",
       "10645                         Mylasandra  1 Bedroom      500.00   2.0   \n",
       "11301               Banashankari Stage V  3 Bedroom     1200.00   4.0   \n",
       "11894                           Sarjapur  3 Bedroom     1500.00   5.0   \n",
       "12103                        Thanisandra      3 BHK     1806.00   6.0   \n",
       "12303                           Kothanur  4 Bedroom     1600.00   5.0   \n",
       "12413                 5th Phase JP Nagar      7 BHK     2500.00   8.0   \n",
       "12699                          Yelahanka      1 BHK      602.00   2.0   \n",
       "\n",
       "       balcony  price  bhk  price_per_sqft   tier  \n",
       "84         2.0  102.0    3     6804.536358  tier2  \n",
       "209        0.0  190.0    4    10944.700461  tier2  \n",
       "439        3.0  110.0    3    11000.000000  tier2  \n",
       "504        0.0   26.0    1     6933.333333  tier1  \n",
       "603        1.0   70.0    3     6222.222222  tier1  \n",
       "1068       3.0  450.0    6    18750.000000  tier5  \n",
       "1078       NaN  500.0    9    15151.515152  tier2  \n",
       "1620       3.0   66.0    3     6600.000000  tier2  \n",
       "1671       0.0   44.5    5     2472.222222  tier1  \n",
       "1978       1.0  185.0    3    14682.539683  tier2  \n",
       "2001       2.0   14.0    1     2800.000000  tier1  \n",
       "2036       1.0   25.0    1     4296.197006  tier1  \n",
       "2560       1.0  230.0    4    15333.333333  tier1  \n",
       "2774       3.0  220.0    4    14666.666667  tier2  \n",
       "2876       0.0   75.0    3     5896.226415  tier2  \n",
       "2994       1.0  140.0    3    10526.315789  tier1  \n",
       "3113       3.0  110.0    3    11000.000000  tier2  \n",
       "3489       1.0  158.0    4    10031.746032  tier2  \n",
       "3745       2.0  160.0    2    19631.901840  tier2  \n",
       "3797       1.0   52.0    2     7703.703704  tier2  \n",
       "4035       0.0  145.0    3    12083.333333  tier4  \n",
       "5220       0.0   55.0    1     9166.666667  tier1  \n",
       "6292       2.0   80.0    3     6666.666667  tier1  \n",
       "6339       1.0   24.0    1     4800.000000  tier1  \n",
       "6662       3.0  233.0    4    15533.333333  tier2  \n",
       "6717       0.0   23.0    1     3833.333333  tier1  \n",
       "6981       2.0  200.0    3    16666.666667  tier1  \n",
       "7070       1.0   25.0    1     6250.000000  tier1  \n",
       "7210       2.0  140.0    5     7356.805045  tier1  \n",
       "7371       3.0  175.0    5     8974.358974  tier2  \n",
       "...        ...    ...  ...             ...    ...  \n",
       "7458       1.0  105.0    2    11666.666667  tier1  \n",
       "7482       1.0   10.0    1     2127.659574  tier1  \n",
       "7484       0.0  160.0    6     6956.521739  tier2  \n",
       "7496       NaN  150.0    3    11424.219345  tier2  \n",
       "7703       3.0  270.0    5    15000.000000  tier2  \n",
       "7730       1.0   59.5    2     7437.500000  tier1  \n",
       "8149       0.0   48.0    1     7741.935484  tier1  \n",
       "8491       2.0  350.0    5    15909.090909  tier3  \n",
       "8533       0.0   29.0    1     5576.923077  tier1  \n",
       "8597       2.0  205.0    3    17083.333333  tier1  \n",
       "8657       1.0   35.0    1     5833.333333  tier2  \n",
       "8714       3.0   39.0    3     3120.000000  tier1  \n",
       "8723       3.0  309.0    4    18727.272727  tier2  \n",
       "8725       1.0   11.5    1     2751.196172  tier1  \n",
       "8810       1.0   70.0    1    11111.111111  tier4  \n",
       "9110       2.0   60.0    2     8823.529412  tier3  \n",
       "9264       3.0   59.5    2     7901.726428  tier2  \n",
       "9611       1.0  220.0    3    18333.333333  tier1  \n",
       "10043      1.0   50.0    1    12500.000000  tier4  \n",
       "10048      2.0  180.0    3    15000.000000  tier5  \n",
       "10124      1.0  156.0    3    13000.000000  tier1  \n",
       "10245      1.0  138.0    2    11500.000000  tier1  \n",
       "10305      3.0  160.0    4    10666.666667  tier2  \n",
       "10645      0.0   80.0    1    16000.000000  tier1  \n",
       "11301      1.0  240.0    3    20000.000000  tier1  \n",
       "11894      2.0   95.0    3     6333.333333  tier1  \n",
       "12103      2.0  116.0    3     6423.034330  tier2  \n",
       "12303      0.0  130.0    4     8125.000000  tier1  \n",
       "12413      3.0   95.0    7     3800.000000  tier1  \n",
       "12699      1.0   30.0    1     4983.388704  tier1  \n",
       "\n",
       "[61 rows x 9 columns]"
      ]
     },
     "execution_count": 56,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df8[(df8.total_sqft/df8.bath) < (1000/3) ]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 57,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(11962, 9)"
      ]
     },
     "execution_count": 57,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df9 = df8[~((df8.total_sqft/df8.bath) < (1000/3)) ]\n",
    "df9.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 58,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>tier1</th>\n",
       "      <th>tier2</th>\n",
       "      <th>tier3</th>\n",
       "      <th>tier4</th>\n",
       "      <th>tier5</th>\n",
       "      <th>tier6</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   tier1  tier2  tier3  tier4  tier5  tier6\n",
       "0      1      0      0      0      0      0\n",
       "1      1      0      0      0      0      0\n",
       "2      1      0      0      0      0      0\n",
       "3      0      1      0      0      0      0\n",
       "4      1      0      0      0      0      0"
      ]
     },
     "execution_count": 58,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "dummies = pd.get_dummies(df9.tier)\n",
    "dummies.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 59,
   "metadata": {},
   "outputs": [],
   "source": [
    "dummies.drop('tier6',axis='columns',inplace=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 60,
   "metadata": {},
   "outputs": [],
   "source": [
    "df10 = pd.concat([df9,dummies],axis='columns')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 61,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>location</th>\n",
       "      <th>size</th>\n",
       "      <th>total_sqft</th>\n",
       "      <th>bath</th>\n",
       "      <th>balcony</th>\n",
       "      <th>price</th>\n",
       "      <th>bhk</th>\n",
       "      <th>price_per_sqft</th>\n",
       "      <th>tier</th>\n",
       "      <th>tier1</th>\n",
       "      <th>tier2</th>\n",
       "      <th>tier3</th>\n",
       "      <th>tier4</th>\n",
       "      <th>tier5</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>Electronic City Phase II</td>\n",
       "      <td>2 BHK</td>\n",
       "      <td>1056.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>39.07</td>\n",
       "      <td>2</td>\n",
       "      <td>3699.810606</td>\n",
       "      <td>tier1</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>Chikka Tirupathi</td>\n",
       "      <td>4 Bedroom</td>\n",
       "      <td>2600.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>120.00</td>\n",
       "      <td>4</td>\n",
       "      <td>4615.384615</td>\n",
       "      <td>tier1</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>Uttarahalli</td>\n",
       "      <td>3 BHK</td>\n",
       "      <td>1440.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>62.00</td>\n",
       "      <td>3</td>\n",
       "      <td>4305.555556</td>\n",
       "      <td>tier1</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>Lingadheeranahalli</td>\n",
       "      <td>3 BHK</td>\n",
       "      <td>1521.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>95.00</td>\n",
       "      <td>3</td>\n",
       "      <td>6245.890861</td>\n",
       "      <td>tier2</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>Kothanur</td>\n",
       "      <td>2 BHK</td>\n",
       "      <td>1200.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>51.00</td>\n",
       "      <td>2</td>\n",
       "      <td>4250.000000</td>\n",
       "      <td>tier1</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                   location       size  total_sqft  bath  balcony   price  \\\n",
       "0  Electronic City Phase II      2 BHK      1056.0   2.0      1.0   39.07   \n",
       "1          Chikka Tirupathi  4 Bedroom      2600.0   5.0      3.0  120.00   \n",
       "2               Uttarahalli      3 BHK      1440.0   2.0      3.0   62.00   \n",
       "3        Lingadheeranahalli      3 BHK      1521.0   3.0      1.0   95.00   \n",
       "4                  Kothanur      2 BHK      1200.0   2.0      1.0   51.00   \n",
       "\n",
       "   bhk  price_per_sqft   tier  tier1  tier2  tier3  tier4  tier5  \n",
       "0    2     3699.810606  tier1      1      0      0      0      0  \n",
       "1    4     4615.384615  tier1      1      0      0      0      0  \n",
       "2    3     4305.555556  tier1      1      0      0      0      0  \n",
       "3    3     6245.890861  tier2      0      1      0      0      0  \n",
       "4    2     4250.000000  tier1      1      0      0      0      0  "
      ]
     },
     "execution_count": 61,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df10.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 62,
   "metadata": {},
   "outputs": [],
   "source": [
    "df11 = df10.drop(['location','size','balcony','price_per_sqft','tier'],axis='columns')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 63,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(11962, 9)"
      ]
     },
     "execution_count": 63,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df11.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 64,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>total_sqft</th>\n",
       "      <th>bath</th>\n",
       "      <th>price</th>\n",
       "      <th>bhk</th>\n",
       "      <th>tier1</th>\n",
       "      <th>tier2</th>\n",
       "      <th>tier3</th>\n",
       "      <th>tier4</th>\n",
       "      <th>tier5</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1056.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>39.07</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2600.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>120.00</td>\n",
       "      <td>4</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>1440.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>62.00</td>\n",
       "      <td>3</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>1521.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>95.00</td>\n",
       "      <td>3</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>1200.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>51.00</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   total_sqft  bath   price  bhk  tier1  tier2  tier3  tier4  tier5\n",
       "0      1056.0   2.0   39.07    2      1      0      0      0      0\n",
       "1      2600.0   5.0  120.00    4      1      0      0      0      0\n",
       "2      1440.0   2.0   62.00    3      1      0      0      0      0\n",
       "3      1521.0   3.0   95.00    3      0      1      0      0      0\n",
       "4      1200.0   2.0   51.00    2      1      0      0      0      0"
      ]
     },
     "execution_count": 64,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df11.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 65,
   "metadata": {},
   "outputs": [],
   "source": [
    "dftemp = df11[(df11.bhk==2) & (df11.bath==2) & (df11.tier1==1)]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 66,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>total_sqft</th>\n",
       "      <th>bath</th>\n",
       "      <th>price</th>\n",
       "      <th>bhk</th>\n",
       "      <th>tier1</th>\n",
       "      <th>tier2</th>\n",
       "      <th>tier3</th>\n",
       "      <th>tier4</th>\n",
       "      <th>tier5</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1056.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>39.07</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>1200.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>51.00</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>1100.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>40.00</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>1175.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>73.50</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>1100.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>48.00</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "    total_sqft  bath  price  bhk  tier1  tier2  tier3  tier4  tier5\n",
       "0       1056.0   2.0  39.07    2      1      0      0      0      0\n",
       "4       1200.0   2.0  51.00    2      1      0      0      0      0\n",
       "13      1100.0   2.0  40.00    2      1      0      0      0      0\n",
       "15      1175.0   2.0  73.50    2      1      0      0      0      0\n",
       "19      1100.0   2.0  48.00    2      1      0      0      0      0"
      ]
     },
     "execution_count": 66,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "dftemp.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 67,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.collections.PathCollection at 0x28c734fb978>"
      ]
     },
     "execution_count": 67,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXoAAAD8CAYAAAB5Pm/hAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4zLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvnQurowAAGr1JREFUeJzt3X+QHOV95/H3V8sCC3axkr1wYiUsmahkh+OQ8BaWS1dXAWILExsptjGkSKz4KFN1savss09nccmdIeUry6dyIK5KOSeC6+SY44eBLHJwTlEhqFQoJHvllZAVrGMhNtJKhTaHVomjdVitvvfHPLPMjrp3enZnpqef+byqtqbnmZ6Zp5/p/c4z3376aXN3REQkXgvyroCIiDSXAr2ISOQU6EVEIqdALyISOQV6EZHIKdCLiEROgV5EJHIK9CIikVOgFxGJ3Hl5VwDgne98py9btizvaoiIFMq+ffv+wd37aq3XFoF+2bJlDA0N5V0NEZFCMbOfZ1lPqRsRkcgp0IuIRE6BXkQkcgr0IiKRU6AXEYlcW4y6ERHpNIPDo2zdeZhj4xNc3tvDpnUr2bC6vynvpUAvItJig8Oj3P3kQSYmpwAYHZ/g7icPAjQl2Ct1IyLSYlt3Hp4O8mUTk1Ns3Xm4Ke+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FehGRyCnQi4hEToFeRCRyCvQiIpFToBcRidz/B/ykooy62wR9AAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.scatter(dftemp.total_sqft,dftemp.price)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<h2 style='color:purple'>Build a model now</h2>"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 68,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>total_sqft</th>\n",
       "      <th>bath</th>\n",
       "      <th>bhk</th>\n",
       "      <th>tier1</th>\n",
       "      <th>tier2</th>\n",
       "      <th>tier3</th>\n",
       "      <th>tier4</th>\n",
       "      <th>tier5</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1056.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2600.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>4</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>1440.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>3</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>1521.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>3</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>1200.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   total_sqft  bath  bhk  tier1  tier2  tier3  tier4  tier5\n",
       "0      1056.0   2.0    2      1      0      0      0      0\n",
       "1      2600.0   5.0    4      1      0      0      0      0\n",
       "2      1440.0   2.0    3      1      0      0      0      0\n",
       "3      1521.0   3.0    3      0      1      0      0      0\n",
       "4      1200.0   2.0    2      1      0      0      0      0"
      ]
     },
     "execution_count": 68,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "X = df11.drop(['price'],axis='columns')\n",
    "X.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 69,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(11962, 8)"
      ]
     },
     "execution_count": 69,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "X.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 70,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0     39.07\n",
       "1    120.00\n",
       "2     62.00\n",
       "3     95.00\n",
       "4     51.00\n",
       "Name: price, dtype: float64"
      ]
     },
     "execution_count": 70,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "y = df11.price\n",
    "y.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 71,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "11962"
      ]
     },
     "execution_count": 71,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "len(y)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 72,
   "metadata": {},
   "outputs": [],
   "source": [
    "from sklearn.model_selection import train_test_split"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 73,
   "metadata": {},
   "outputs": [],
   "source": [
    "X_train, X_test, y_train, y_test = train_test_split(X,y,test_size=0.2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 74,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "9569"
      ]
     },
     "execution_count": 74,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "len(X_train)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 75,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "2393"
      ]
     },
     "execution_count": 75,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "len(X_test)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 76,
   "metadata": {},
   "outputs": [],
   "source": [
    "from sklearn.linear_model import LinearRegression\n",
    "model = LinearRegression()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 77,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "LinearRegression(copy_X=True, fit_intercept=True, n_jobs=None,\n",
       "         normalize=False)"
      ]
     },
     "execution_count": 77,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "model.fit(X_train,y_train)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 78,
   "metadata": {
    "scrolled": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0.7378694890552453"
      ]
     },
     "execution_count": 78,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "model.score(X_test,y_test)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<h2 style='color:purple'>Use K-Fold cross validation to measure score of a model</h2>"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 79,
   "metadata": {},
   "outputs": [],
   "source": [
    "from sklearn.model_selection import cross_val_score"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 80,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([0.77887482, 0.79813809, 0.71873219, 0.73208172, 0.75941746,\n",
       "       0.73426984, 0.7522922 , 0.73804447, 0.74377453, 0.75164493])"
      ]
     },
     "execution_count": 80,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "cross_val_score(LinearRegression(), X,y,cv=10)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**If this was a classification problem, we could have used different classification algorithms and GridSearchCV to come up with best algorithm and best hyperparameters**"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 81,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>total_sqft</th>\n",
       "      <th>bath</th>\n",
       "      <th>bhk</th>\n",
       "      <th>tier1</th>\n",
       "      <th>tier2</th>\n",
       "      <th>tier3</th>\n",
       "      <th>tier4</th>\n",
       "      <th>tier5</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>10528</th>\n",
       "      <td>1265.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5818</th>\n",
       "      <td>3532.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>4</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2008</th>\n",
       "      <td>1521.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>3</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4769</th>\n",
       "      <td>1310.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>3</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10189</th>\n",
       "      <td>1200.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12408</th>\n",
       "      <td>3295.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>3</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2325</th>\n",
       "      <td>1655.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>3</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12478</th>\n",
       "      <td>1194.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4618</th>\n",
       "      <td>1070.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11654</th>\n",
       "      <td>648.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "       total_sqft  bath  bhk  tier1  tier2  tier3  tier4  tier5\n",
       "10528      1265.0   2.0    2      0      1      0      0      0\n",
       "5818       3532.0   3.0    4      0      1      0      0      0\n",
       "2008       1521.0   3.0    3      0      1      0      0      0\n",
       "4769       1310.0   2.0    3      1      0      0      0      0\n",
       "10189      1200.0   2.0    2      0      1      0      0      0\n",
       "12408      3295.0   3.0    3      0      1      0      0      0\n",
       "2325       1655.0   3.0    3      0      1      0      0      0\n",
       "12478      1194.0   2.0    2      1      0      0      0      0\n",
       "4618       1070.0   2.0    2      1      0      0      0      0\n",
       "11654       648.0   1.0    1      0      1      0      0      0"
      ]
     },
     "execution_count": 81,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "X_test.head(10)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 82,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "10528     68.00\n",
       "5818     170.00\n",
       "2008      94.99\n",
       "4769      32.75\n",
       "10189    135.00\n",
       "12408    310.00\n",
       "2325     115.00\n",
       "12478     46.00\n",
       "4618      42.80\n",
       "11654     40.00\n",
       "Name: price, dtype: float64"
      ]
     },
     "execution_count": 82,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "y_test.head(10)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 83,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([ 78.56165646, 267.87973049, 100.02834669,  57.91431519,\n",
       "        72.84470152, 256.05723999, 111.81406918,  56.7341562 ,\n",
       "        45.82796524,  25.34387803])"
      ]
     },
     "execution_count": 83,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "model.predict(X_test[:10])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 90,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>bath</th>\n",
       "      <th>bhk</th>\n",
       "      <th>tier1</th>\n",
       "      <th>tier2</th>\n",
       "      <th>tier3</th>\n",
       "      <th>tier4</th>\n",
       "      <th>tier5</th>\n",
       "      <th>total_sqft</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1056</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   bath  bhk  tier1  tier2  tier3  tier4  tier5  total_sqft\n",
       "0     2    2      1      0      0      0      0        1056"
      ]
     },
     "execution_count": 90,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    " df_test = pd.DataFrame([{\n",
    "            'total_sqft': 1056,\n",
    "            'bhk': 2,\n",
    "            'bath': 2,\n",
    "            'tier1': 1,\n",
    "            'tier2': 0,\n",
    "            'tier3': 0,\n",
    "            'tier4': 0,\n",
    "            'tier5': 0\n",
    "        }])\n",
    "\n",
    "df_test"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 92,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([44.5966211])"
      ]
     },
     "execution_count": 92,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "model.predict([[1056,2,2,1,0,0,0,0]])"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<h2 style='color:purple'>Export trained model and other artifacts</h2>"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 84,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pickle\n",
    "\n",
    "with open('banglore_home_prices_model.pickle','wb') as f:\n",
    "    pickle.dump(model,f)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 85,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>tier1</th>\n",
       "      <th>tier2</th>\n",
       "      <th>tier3</th>\n",
       "      <th>tier4</th>\n",
       "      <th>tier5</th>\n",
       "      <th>tier6</th>\n",
       "      <th>tier</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>location</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>Electronic City Phase II</th>\n",
       "      <td>100</td>\n",
       "      <td>23</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>tier1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Chikka Tirupathi</th>\n",
       "      <td>12</td>\n",
       "      <td>5</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>tier1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Uttarahalli</th>\n",
       "      <td>157</td>\n",
       "      <td>20</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>tier1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Lingadheeranahalli</th>\n",
       "      <td>1</td>\n",
       "      <td>21</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>tier2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Kothanur</th>\n",
       "      <td>39</td>\n",
       "      <td>21</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>tier1</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                          tier1  tier2  tier3  tier4  tier5  tier6   tier\n",
       "location                                                                 \n",
       "Electronic City Phase II    100     23      0      0      0      0  tier1\n",
       "Chikka Tirupathi             12      5      0      0      0      0  tier1\n",
       "Uttarahalli                 157     20      1      0      0      0  tier1\n",
       "Lingadheeranahalli            1     21      1      0      0      0  tier2\n",
       "Kothanur                     39     21      2      0      1      0  tier1"
      ]
     },
     "execution_count": 85,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "tier_df.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 86,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>tier</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>location</th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>Electronic City Phase II</th>\n",
       "      <td>tier1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Chikka Tirupathi</th>\n",
       "      <td>tier1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Uttarahalli</th>\n",
       "      <td>tier1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Lingadheeranahalli</th>\n",
       "      <td>tier2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Kothanur</th>\n",
       "      <td>tier1</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                           tier\n",
       "location                       \n",
       "Electronic City Phase II  tier1\n",
       "Chikka Tirupathi          tier1\n",
       "Uttarahalli               tier1\n",
       "Lingadheeranahalli        tier2\n",
       "Kothanur                  tier1"
      ]
     },
     "execution_count": 86,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "tier_df[['tier']].head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 87,
   "metadata": {},
   "outputs": [],
   "source": [
    "tier_df.index = tier_df.index.str.lower()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 88,
   "metadata": {},
   "outputs": [],
   "source": [
    "with open('location_tiers.pickle','wb') as f:\n",
    "    pickle.dump(tier_df[['tier']],f)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
